gocodebox/lifterlms

View on GitHub
includes/class.llms.person.handler.php

Summary

Maintainability
B
6 hrs
Test Coverage
A
97%

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

    Method get_lost_password_fields has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get_lost_password_fields() {
    
            $usernames = LLMS_Forms::instance()->are_usernames_enabled();
    
            if ( ! $usernames ) {
    Severity: Minor
    Found in includes/class.llms.person.handler.php - About 1 hr to fix

      Method get_password_fields has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static function get_password_fields() {
      
              $fields = array();
      
              $fields[] = array(
      Severity: Minor
      Found in includes/class.llms.person.handler.php - About 1 hr to fix

        Method get_password_reset_fields has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function get_password_reset_fields( $key = '', $login = '' ) {
        
                $fields = array();
                foreach ( array( 'checkout', 'registration' ) as $location ) {
                    $fields = self::find_password_fields( $location );
        Severity: Minor
        Found in includes/class.llms.person.handler.php - About 1 hr to fix

          Function find_password_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function find_password_fields( $location ) {
          
                  $forms = LLMS_Forms::instance();
                  $all   = $forms->get_form_fields( $location );
          
          
          Severity: Minor
          Found in includes/class.llms.person.handler.php - About 35 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 validate_login_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function validate_login_fields( $data ) {
          
                  $err = new WP_Error();
          
                  $fields = self::get_login_fields();
          Severity: Minor
          Found in includes/class.llms.person.handler.php - About 35 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