gocodebox/lifterlms-rest

View on GitHub

Showing 191 of 191 total issues

Avoid too many return statements within this method.
Open

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

    Avoid too many return statements within this method.
    Open

            return $response;
    Severity: Major
    Found in includes/server/class-llms-rest-enrollments-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 $fields_update;
        Severity: Major
        Found in includes/server/class-llms-rest-enrollments-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-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 $fields_update;
                Severity: Major
                Found in includes/server/class-llms-rest-enrollments-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 llms_rest_server_error( __( 'The enrollment status could not be updated', 'lifterlms' ) );
                      Severity: Major
                      Found in includes/server/class-llms-rest-enrollments-controller.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return $prepared;
                        Severity: Major
                        Found in includes/abstracts/class-llms-rest-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

                              Avoid too many return statements within this method.
                              Open

                                              return llms_rest_server_error( __( 'The enrollment creation date could not be updated', 'lifterlms' ) );
                              Severity: Major
                              Found in includes/server/class-llms-rest-enrollments-controller.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

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

                                  Avoid too many return statements within this method.
                                  Open

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

                                    Avoid too many return statements within this method.
                                    Open

                                            return $user_id;
                                    Severity: Major
                                    Found in includes/class-llms-rest-authentication.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 is_data_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          protected function is_data_valid( $data ) {
                                      
                                              // Validate Status.
                                              if ( isset( $data['status'] ) && ! in_array( $data['status'], array_keys( $this->get_statuses() ), true ) ) {
                                                  // Translators: %s = Invalid permission string.
                                      Severity: Minor
                                      Found in includes/class-llms-rest-webhooks.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language