modxcms/revolution

View on GitHub
core/model/modx/processors/security/login.class.php

Summary

Maintainability
D
1 day
Test Coverage

File login.class.php has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * This file is part of MODX Revolution.
 *
 * Copyright (c) MODX, LLC. All Rights Reserved.
Severity: Minor
Found in core/model/modx/processors/security/login.class.php - About 3 hrs to fix

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

        public function fireOnUserNotFoundEvent() {
            if (!$this->user) {
                $OnUserNotFoundParams = array(
                    'user' => &$this->user,
                    'username' => $this->username,
    Severity: Minor
    Found in core/model/modx/processors/security/login.class.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 checkPassword has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkPassword($rt) {
            /* check if plugin authenticated the user */
            if (!$rt || (is_array($rt) && !in_array(true, $rt))) {
                /* check user password - local authentication */
                if (!$this->user->passwordMatches($this->givenPassword)) {
    Severity: Minor
    Found in core/model/modx/processors/security/login.class.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 checkIsBlocked has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function checkIsBlocked() {
            if (!$this->user->get('active')) {
                return $this->modx->lexicon('login_user_inactive');
            }
    
    
    Severity: Minor
    Found in core/model/modx/processors/security/login.class.php - About 1 hr to fix

      Function checkIsBlocked has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function checkIsBlocked() {
              if (!$this->user->get('active')) {
                  return $this->modx->lexicon('login_user_inactive');
              }
      
      
      Severity: Minor
      Found in core/model/modx/processors/security/login.class.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 checkUserSettings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function checkUserSettings() {
              /**
               * @var string $settingPK
               * @var modUserSetting $setting
               */
      Severity: Minor
      Found in core/model/modx/processors/security/login.class.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 fireOnUserNotFoundEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function fireOnUserNotFoundEvent() {
              if (!$this->user) {
                  $OnUserNotFoundParams = array(
                      'user' => &$this->user,
                      'username' => $this->username,
      Severity: Minor
      Found in core/model/modx/processors/security/login.class.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return $this->modx->lexicon('login_blocked_error');
        Severity: Major
        Found in core/model/modx/processors/security/login.class.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return false;    
          Severity: Major
          Found in core/model/modx/processors/security/login.class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return false;
            Severity: Major
            Found in core/model/modx/processors/security/login.class.php - About 30 mins to fix

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

                  public function fireOnBeforeLoginEvent() {
                      $onBeforeLoginParams = array(
                          'username' => $this->username,
                          'password' => $this->givenPassword,
                          'attributes' => array(
              Severity: Minor
              Found in core/model/modx/processors/security/login.class.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