gocodebox/lifterlms

View on GitHub
includes/forms/class-llms-forms.php

Summary

Maintainability
D
2 days
Test Coverage
A
91%

File class-llms-forms.php has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Register and manage LifterLMS user forms.
 *
 * @package LifterLMS/Classes
Severity: Minor
Found in includes/forms/class-llms-forms.php - About 6 hrs to fix

    LLMS_Forms has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class LLMS_Forms {
    
        use LLMS_Trait_Singleton;
    
        /**
    Severity: Minor
    Found in includes/forms/class-llms-forms.php - About 5 hrs to fix

      Function get_block_tree has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          private function get_block_tree( $block, $block_list ) {
      
              foreach ( $block_list as &$_block ) {
      
                  // Found the block.
      Severity: Minor
      Found in includes/forms/class-llms-forms.php - About 2 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

      Function get_block_path has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          private function get_block_path( $block, $block_list, $iterations = 0 ) {
      
              foreach ( $block_list as $_block ) {
      
                  // Found the block.
      Severity: Minor
      Found in includes/forms/class-llms-forms.php - About 2 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

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

          public function load_reusable_blocks( $blocks ) {
      
              $loaded = array();
      
              foreach ( $blocks as $block ) {
      Severity: Minor
      Found in includes/forms/class-llms-forms.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_fields_settings_from_blocks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_fields_settings_from_blocks( $blocks ) {
      
              $fields = array();
              $blocks = $this->get_field_blocks( $blocks );
      
      
      Severity: Minor
      Found in includes/forms/class-llms-forms.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_core_forms has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function get_core_forms( $return = 'posts', $use_cache = true ) {
      
              global $wpdb;
      
              $forms_cache_key = 'posts' === $return ? 'llms_core_forms' : 'llms_core_form_ids';
      Severity: Minor
      Found in includes/forms/class-llms-forms.php - About 1 hr to fix

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

            private function cascade_visibility_attrs( $blocks, $visibility = null ) {
        
                foreach ( $blocks as &$block ) {
        
                    // If a visibility setting has been passed from the parent and the block does not have visibility setting of it's own.
        Severity: Minor
        Found in includes/forms/class-llms-forms.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_field_blocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get_field_blocks( $blocks ) {
        
                $fields = array();
        
                foreach ( $blocks as $block ) {
        Severity: Minor
        Found in includes/forms/class-llms-forms.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

        There are no issues that match your filters.

        Category
        Status