gocodebox/lifterlms-rest

View on GitHub

Showing 156 of 191 total issues

Method create_item has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create_item( $request ) {

        $user_id = (int) $request['id'];
        $post_id = (int) $request['post_id'];

Severity: Minor
Found in includes/server/class-llms-rest-enrollments-controller.php - About 1 hr to fix

    Method get_schema has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get_schema( $schema, $collate ) {
    
            global $wpdb;
    
            $schema .= "
    Severity: Minor
    Found in includes/class-llms-rest-install.php - About 1 hr to fix

      Method handle_webhook_upsert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function handle_webhook_upsert() {
      
              $data = array(
                  'name'         => llms_filter_input_sanitize_string( INPUT_POST, 'llms_rest_webhook_name' ),
                  'status'       => llms_filter_input_sanitize_string( INPUT_POST, 'llms_rest_webhook_status' ),
      Severity: Minor
      Found in includes/admin/class-llms-rest-admin-form-controller.php - About 1 hr to fix

        Method sql_where has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function sql_where() {
        
                global $wpdb;
        
                $sql = 'WHERE 1';
        Severity: Minor
        Found in includes/class-llms-rest-webhooks-query.php - About 1 hr to fix

          Method deliver has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function deliver( $args ) {
          
                  $start   = microtime( true );
                  $payload = $this->get_payload( $args );
          
          
          Severity: Minor
          Found in includes/models/class-llms-rest-webhook.php - About 1 hr to fix

            Function delivery_after has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function delivery_after( $delivery_id, $req_args, $res, $duration ) {
            
                    // Parse response.
                    if ( is_wp_error( $res ) ) {
                        $res_code    = $res->get_error_code();
            Severity: Minor
            Found in includes/models/class-llms-rest-webhook.php - About 1 hr 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 check_roles_permissions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function check_roles_permissions( $request ) {
            
                    global $wp_roles;
            
                    $schema = $this->get_item_schema();
            Severity: Minor
            Found in includes/abstracts/class-llms-rest-users-controller.php - About 1 hr 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_object_for_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function prepare_object_for_response( $access_plan, $request ) {
            
                    $data    = parent::prepare_object_for_response( $access_plan, $request );
                    $context = $request->get_param( 'context' );
            
            
            Severity: Minor
            Found in includes/server/class-llms-rest-access-plans-controller.php - About 1 hr 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 get_payload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function get_payload( $args ) {
            
                    // Switch current user to the user who created the webhook.
                    $current_user = get_current_user_id();
                    wp_set_current_user( $this->get( 'user_id' ) );
            Severity: Minor
            Found in includes/abstracts/class-llms-rest-webhook-data.php - About 1 hr 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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function( source, options ) {
            
                const
                    opts = Object.assign( {
                        indent: '  '
            Severity: Minor
            Found in .bin/httpsnippet-client-for-llms-node-api.js - About 1 hr to fix

              Method get_payload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function get_payload( $args ) {
              
                      // Switch current user to the user who created the webhook.
                      $current_user = get_current_user_id();
                      wp_set_current_user( $this->get( 'user_id' ) );
              Severity: Minor
              Found in includes/abstracts/class-llms-rest-webhook-data.php - About 1 hr to fix

                Method prepare_object_for_response has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function prepare_object_for_response( $lesson, $request ) {
                
                        $data = parent::prepare_object_for_response( $lesson, $request );
                
                        // Audio Embed.
                Severity: Minor
                Found in includes/server/class-llms-rest-lessons-controller.php - About 1 hr to fix

                  Method check_roles_permissions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function check_roles_permissions( $request ) {
                  
                          global $wp_roles;
                  
                          $schema = $this->get_item_schema();
                  Severity: Minor
                  Found in includes/abstracts/class-llms-rest-users-controller.php - About 1 hr to fix

                    Method get_objects_query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function get_objects_query( $prepared, $request ) {
                    
                            if ( 'id' === $prepared['orderby'] ) {
                                $prepared['orderby'] = 'ID';
                            } elseif ( 'registered_date' === $prepared['orderby'] ) {
                    Severity: Minor
                    Found in includes/abstracts/class-llms-rest-users-controller.php - About 1 hr to fix

                      Method update_additional_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function update_additional_data( $object_id, $prepared, $request ) {
                      
                              $object = $this->get_object( $object_id );
                      
                              if ( is_wp_error( $object ) ) {
                      Severity: Minor
                      Found in includes/abstracts/class-llms-rest-users-controller.php - About 1 hr to fix

                        Function unset_subordinate_props has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function unset_subordinate_props( &$to_set, $saved_props ) {
                        
                                // Merge new properties to set and saved props.
                                $props = wp_parse_args( $to_set, $saved_props );
                        
                        
                        Severity: Minor
                        Found in includes/server/class-llms-rest-access-plans-controller.php - About 55 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_items_query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function prepare_items_query( $prepared_args = array(), $request = null ) {
                        
                                $query_args = array();
                        
                                foreach ( $prepared_args as $key => $value ) {
                        Severity: Minor
                        Found in includes/server/class-llms-rest-enrollments-controller.php - About 55 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_links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function prepare_links( $object, $request ) {
                        
                                $links = parent::prepare_links( $object, $request );
                        
                                $object_id = $object->get( 'id' );
                        Severity: Minor
                        Found in includes/abstracts/class-llms-rest-posts-controller.php - About 55 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 update_additional_object_fields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function update_additional_object_fields( $lesson, $request, $schema, $prepared_item, $creating = true ) {
                        
                                $error = new WP_Error();
                        
                                $to_set = array();
                        Severity: Minor
                        Found in includes/server/class-llms-rest-lessons-controller.php - About 55 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 handle_webhook_upsert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function handle_webhook_upsert() {
                        
                                $data = array(
                                    'name'         => llms_filter_input_sanitize_string( INPUT_POST, 'llms_rest_webhook_name' ),
                                    'status'       => llms_filter_input_sanitize_string( INPUT_POST, 'llms_rest_webhook_status' ),
                        Severity: Minor
                        Found in includes/admin/class-llms-rest-admin-form-controller.php - About 55 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

                        Severity
                        Category
                        Status
                        Source
                        Language