gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method handle_ajax has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function handle_ajax( $request ) {

        if ( ! $request['course_id'] || ! current_user_can( 'edit_course', $request['course_id'] ) ) {
            return array();
        }
Severity: Minor
Found in includes/admin/class.llms.admin.builder.php - About 1 hr to fix

    Method maybe_handle_awarded_engagement_sync_actions has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function maybe_handle_awarded_engagement_sync_actions() {
    
            // Validate action.
            // Invalid actions return a WP_Error for testing purposes and are not displayed to the user.
            $actions = array(
    Severity: Minor
    Found in includes/abstracts/llms-abstract-controller-user-engagements.php - About 1 hr to fix

      Method get_order_statuses has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function get_order_statuses() {
      
              $statuses = array(
      
                  // Single payment only.
      Severity: Minor
      Found in includes/class.llms.post-types.php - About 1 hr to fix

        Method get_config has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function get_config(): array {
                $config = array(
                    'access-plan-button'   => array(
                        'render' => array( 'LLMS_Shortcodes', 'access_plan_button' ),
                    ),
        Severity: Minor
        Found in includes/shortcodes/class.llms.shortcodes.blocks.php - About 1 hr to fix

          Method set_merge_data has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function set_merge_data( $code ) {
          
                  $order = $this->post;
          
                  switch ( $code ) {

            Method set_merge_data has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function set_merge_data( $code ) {
            
                    $order = $this->post;
            
                    switch ( $code ) {

              Method set_merge_data has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function set_merge_data( $code ) {
              
                      $order = $this->post;
              
                      switch ( $code ) {

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

                    public function output() {
                
                        global $post;
                
                        if ( isset( $this->field['meta'] ) ) {

                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 manage_columns has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function manage_columns( $column, $post_id ) {
                
                        $lesson = llms_get_post( $post_id );
                        if ( ! $lesson ) {
                            return;

                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_quiz has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function update_quiz( $quiz_data, $lesson ) {
                
                        $res = array_merge(
                            $quiz_data,
                            array(
                Severity: Minor
                Found in includes/admin/class.llms.admin.builder.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 process_detachments has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function process_detachments( $data ) {
                
                        $ret = array();
                
                        foreach ( $data['detach'] as $id ) {
                Severity: Minor
                Found in includes/admin/class.llms.admin.builder.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 heartbeat_received has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function heartbeat_received( $res, $data ) {
                
                        // Exit if there's no builder data in the heartbeat data.
                        if ( empty( $data['llms_builder'] ) ) {
                            return $res;
                Severity: Minor
                Found in includes/admin/class.llms.admin.builder.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 add_subscriptions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function add_subscriptions( $filter_types = null ) {
                
                        foreach ( array_keys( $this->get_supported_types() ) as $type ) {
                            if ( ! is_null( $filter_types ) && ! in_array( $type, $filter_types, true ) ) {
                                continue;
                Severity: Minor
                Found in includes/abstracts/llms.abstract.notification.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 duplicate_meta has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function duplicate_meta( $post_id, $new_post_id ) {
                        global $wpdb;
                
                        // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
                        // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
                Severity: Minor
                Found in includes/class.llms.lesson.handler.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 lifterlms_template_my_courses_loop has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    function lifterlms_template_my_courses_loop( $student = null, $preview = false ) {
                
                        $student = llms_get_student( $student );
                        if ( ! $student ) {
                            return;
                Severity: Minor
                Found in includes/functions/llms.functions.templates.dashboard.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 llms_template_my_favorites_loop has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    function llms_template_my_favorites_loop( $student = null, $favorites = null ) {
                
                        $student = llms_get_student( $student );
                        if ( ! $student ) {
                            return;
                Severity: Minor
                Found in includes/functions/llms.functions.templates.dashboard.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 get_text has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function get_text( $text_type, $variables = array() ) {
                
                        switch ( $text_type ) {
                            case self::TEXT_SYNC_ALERT_MANY_AWARDED_ENGAGEMENTS:
                                return sprintf(

                  Method get_text has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function get_text( $text_type, $variables = array() ) {
                  
                          switch ( $text_type ) {
                              case self::TEXT_SYNC_ALERT_MANY_AWARDED_ENGAGEMENTS:
                                  return sprintf(

                    Method get_field_options has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function get_field_options( $type ) {
                    
                            $options = array();
                    
                            if ( $this->has_field_support( $type, 'subject' ) ) {
                    Severity: Minor
                    Found in includes/abstracts/llms.abstract.notification.view.php - About 1 hr to fix

                      Method get_login_fields has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function get_login_fields( $layout = 'columns' ) {
                      
                              $usernames = LLMS_Forms::instance()->are_usernames_enabled();
                      
                              /**
                      Severity: Minor
                      Found in includes/class.llms.person.handler.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language