gocodebox/lifterlms-rest

View on GitHub
includes/abstracts/class-llms-rest-posts-controller.php

Summary

Maintainability
F
1 wk
Test Coverage
B
85%

File class-llms-rest-posts-controller.php has 936 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * REST LLMS Posts Controller Class
 *
 * @package LifterLMS_REST/Abstracts
Severity: Major
Found in includes/abstracts/class-llms-rest-posts-controller.php - About 2 days to fix

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

        protected function get_item_schema_base() {
    
            $schema = array(
                '$schema'    => 'http://json-schema.org/draft-04/schema#',
                'title'      => $this->post_type,
    Severity: Major
    Found in includes/abstracts/class-llms-rest-posts-controller.php - About 7 hrs to fix

      LLMS_REST_Posts_Controller has 47 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class LLMS_REST_Posts_Controller extends LLMS_REST_Controller {
      
          /**
           * Post type.
           *
      Severity: Minor
      Found in includes/abstracts/class-llms-rest-posts-controller.php - About 6 hrs to fix

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

            protected function prepare_item_for_database( $request ) {
        
                $prepared_item = array();
        
                // LLMS Post ID.
        Severity: Minor
        Found in includes/abstracts/class-llms-rest-posts-controller.php - About 4 hrs 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

        Method prepare_item_for_database has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function prepare_item_for_database( $request ) {
        
                $prepared_item = array();
        
                // LLMS Post ID.
        Severity: Major
        Found in includes/abstracts/class-llms-rest-posts-controller.php - About 2 hrs to fix

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

              public function create_item( $request ) {
          
                  $schema = $this->get_item_schema();
          
                  $prepared_item = $this->prepare_item_for_database( $request );
          Severity: Major
          Found in includes/abstracts/class-llms-rest-posts-controller.php - About 2 hrs to fix

            Function create_item has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                public function create_item( $request ) {
            
                    $schema = $this->get_item_schema();
            
                    $prepared_item = $this->prepare_item_for_database( $request );
            Severity: Minor
            Found in includes/abstracts/class-llms-rest-posts-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

            Method update_item has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function update_item( $request ) {
            
                    $object = $this->get_object( (int) $request['id'] );
                    if ( is_wp_error( $object ) ) {
                        return $object;
            Severity: Minor
            Found in includes/abstracts/class-llms-rest-posts-controller.php - About 1 hr to fix

              Method delete_item has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function delete_item( $request ) {
              
                      $object   = $this->get_object( (int) $request['id'] );
                      $response = new WP_REST_Response();
                      $response->set_status( 204 );
              Severity: Minor
              Found in includes/abstracts/class-llms-rest-posts-controller.php - About 1 hr to fix

                Function check_assign_terms_permission has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function check_assign_terms_permission( $request ) {
                        $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_llms_rest' => true ) );
                        foreach ( $taxonomies as $taxonomy ) {
                            $base = $this->get_taxonomy_rest_base( $taxonomy );
                
                
                Severity: Minor
                Found in includes/abstracts/class-llms-rest-posts-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 sanitize_post_statuses has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function sanitize_post_statuses( $statuses, $request, $parameter ) {
                        $statuses = wp_parse_slug_list( $statuses );
                
                        $attributes     = $request->get_attributes();
                        $default_status = $attributes['args']['status']['default'];
                Severity: Minor
                Found in includes/abstracts/class-llms-rest-posts-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 update_item has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function update_item( $request ) {
                
                        $object = $this->get_object( (int) $request['id'] );
                        if ( is_wp_error( $object ) ) {
                            return $object;
                Severity: Minor
                Found in includes/abstracts/class-llms-rest-posts-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

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

                    protected function prepare_object_for_response( $object, $request ) {
                
                        $object_id         = $object->get( 'id' );
                        $password_required = post_password_required( $object_id );
                        $password          = $object->get( 'password' );
                Severity: Minor
                Found in includes/abstracts/class-llms-rest-posts-controller.php - About 1 hr to fix

                  Method prepare_links has 33 lines of code (exceeds 25 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 1 hr to fix

                    Function delete_item has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function delete_item( $request ) {
                    
                            $object   = $this->get_object( (int) $request['id'] );
                            $response = new WP_REST_Response();
                            $response->set_status( 204 );
                    Severity: Minor
                    Found in includes/abstracts/class-llms-rest-posts-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 maybe_remove_filters_for_response has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function maybe_remove_filters_for_response( $object ) {
                    
                            $filters_to_be_removed = $this->get_filters_to_be_removed_for_response( $object );
                            $filters_removed       = array();
                    
                    
                    Severity: Minor
                    Found in includes/abstracts/class-llms-rest-posts-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_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 check_read_permission has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function check_read_permission( $object ) {
                    
                            if ( is_wp_error( $object ) ) {
                                return false;
                            }
                    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 handle_status_param has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function handle_status_param( $status ) {
                    
                            $post_type_object = get_post_type_object( $this->post_type );
                            $post_type_name   = $post_type_object->labels->name;
                    
                    
                    Severity: Minor
                    Found in includes/abstracts/class-llms-rest-posts-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 get_item_permissions_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function get_item_permissions_check( $request ) {
                    
                            $object = $this->get_object( (int) $request['id'] );
                            if ( is_wp_error( $object ) ) {
                                return $object;
                    Severity: Minor
                    Found in includes/abstracts/class-llms-rest-posts-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

                    Avoid too many return statements within this method.
                    Open

                                return $fields_update;
                    Severity: Major
                    Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return true;
                      Severity: Major
                      Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return false;
                        Severity: Major
                        Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $fields_update;
                          Severity: Major
                          Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return $meta_update;
                            Severity: Major
                            Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return $terms_update;
                              Severity: Major
                              Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return $meta_update;
                                Severity: Major
                                Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return true;
                                  Severity: Major
                                  Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return $response;
                                    Severity: Major
                                    Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return $response;
                                      Severity: Major
                                      Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return $terms_update;
                                        Severity: Major
                                        Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return $this->prepare_item_for_response( $object, $request );
                                          Severity: Major
                                          Found in includes/abstracts/class-llms-rest-posts-controller.php - About 30 mins to fix

                                            Function maybe_add_removed_filters_for_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                protected function maybe_add_removed_filters_for_response( $filters_removed ) {
                                            
                                                    if ( ! empty( $filters_removed ) ) {
                                                        foreach ( $filters_removed as $hook => $filters ) {
                                                            foreach ( $filters as $filter_data ) {
                                            Severity: Minor
                                            Found in includes/abstracts/class-llms-rest-posts-controller.php - About 25 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_terms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                protected function handle_terms( $object_id, $request ) {
                                            
                                                    $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_llms_rest' => true ) );
                                            
                                                    foreach ( $taxonomies as $taxonomy ) {
                                            Severity: Minor
                                            Found in includes/abstracts/class-llms-rest-posts-controller.php - About 25 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

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                                'properties'  => array(
                                                                    'rendered'  => array(
                                                                        'description' => __( 'Rendered HTML content.', 'lifterlms' ),
                                                                        'type'        => 'string',
                                                                        'context'     => array( 'view', 'edit' ),
                                            Severity: Major
                                            Found in includes/abstracts/class-llms-rest-posts-controller.php and 1 other location - About 2 hrs to fix
                                            includes/abstracts/class-llms-rest-posts-controller.php on lines 1210..1228

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 133.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                                'properties'  => array(
                                                                    'rendered'  => array(
                                                                        'description' => __( 'Rendered HTML excerpt.', 'lifterlms' ),
                                                                        'type'        => 'string',
                                                                        'context'     => array( 'view', 'edit' ),
                                            Severity: Major
                                            Found in includes/abstracts/class-llms-rest-posts-controller.php and 1 other location - About 2 hrs to fix
                                            includes/abstracts/class-llms-rest-posts-controller.php on lines 1182..1200

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 133.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 9 locations. Consider refactoring.
                                            Open

                                                    if ( ! empty( $schema['properties']['excerpt'] ) && isset( $request['excerpt'] ) ) {
                                                        if ( is_string( $request['excerpt'] ) ) {
                                                            $prepared_item['post_excerpt'] = $request['excerpt'];
                                                        } elseif ( isset( $request['excerpt']['raw'] ) ) {
                                                            $prepared_item['post_excerpt'] = $request['excerpt']['raw'];
                                            Severity: Major
                                            Found in includes/abstracts/class-llms-rest-posts-controller.php and 8 other locations - About 30 mins to fix
                                            includes/abstracts/class-llms-rest-posts-controller.php on lines 1026..1032
                                            includes/server/class-llms-rest-courses-controller.php on lines 730..736
                                            includes/server/class-llms-rest-courses-controller.php on lines 744..750
                                            includes/server/class-llms-rest-courses-controller.php on lines 753..759
                                            includes/server/class-llms-rest-courses-controller.php on lines 930..936
                                            includes/server/class-llms-rest-courses-controller.php on lines 938..944
                                            includes/server/class-llms-rest-courses-controller.php on lines 947..953
                                            includes/server/class-llms-rest-courses-controller.php on lines 955..961

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 91.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            Similar blocks of code found in 9 locations. Consider refactoring.
                                            Open

                                                    if ( ! empty( $schema['properties']['content'] ) && isset( $request['content'] ) ) {
                                                        if ( is_string( $request['content'] ) ) {
                                                            $prepared_item['post_content'] = $request['content'];
                                                        } elseif ( isset( $request['content']['raw'] ) ) {
                                                            $prepared_item['post_content'] = $request['content']['raw'];
                                            Severity: Major
                                            Found in includes/abstracts/class-llms-rest-posts-controller.php and 8 other locations - About 30 mins to fix
                                            includes/abstracts/class-llms-rest-posts-controller.php on lines 1035..1041
                                            includes/server/class-llms-rest-courses-controller.php on lines 730..736
                                            includes/server/class-llms-rest-courses-controller.php on lines 744..750
                                            includes/server/class-llms-rest-courses-controller.php on lines 753..759
                                            includes/server/class-llms-rest-courses-controller.php on lines 930..936
                                            includes/server/class-llms-rest-courses-controller.php on lines 938..944
                                            includes/server/class-llms-rest-courses-controller.php on lines 947..953
                                            includes/server/class-llms-rest-courses-controller.php on lines 955..961

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 91.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

                                            There are no issues that match your filters.

                                            Category
                                            Status