gocodebox/lifterlms-rest

View on GitHub
includes/server/class-llms-rest-api-keys-controller.php

Summary

Maintainability
B
5 hrs
Test Coverage
A
95%

LLMS_REST_API_Keys_Controller has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class LLMS_REST_API_Keys_Controller extends LLMS_REST_Controller {

    /**
     * Route base.
     *
Severity: Minor
Found in includes/server/class-llms-rest-api-keys-controller.php - About 2 hrs to fix

    Method get_item_schema_base has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function get_item_schema_base() {
    
            return array(
                '$schema'    => 'http://json-schema.org/draft-04/schema#',
                'title'      => 'api_key',
    Severity: Minor
    Found in includes/server/class-llms-rest-api-keys-controller.php - About 1 hr to fix

      Function prepare_collection_query_args has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function prepare_collection_query_args( $request ) {
      
              $args   = array();
              $params = $this->get_collection_params();
      
      
      Severity: Minor
      Found in includes/server/class-llms-rest-api-keys-controller.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function prepare_item_for_database has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function prepare_item_for_database( $request ) {
      
              $prepared = array();
      
              if ( isset( $request['id'] ) ) {
      Severity: Minor
      Found in includes/server/class-llms-rest-api-keys-controller.php - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      There are no issues that match your filters.

      Category
      Status