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.
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,
- Read upRead up
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)) {
- Read upRead up
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');
}
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');
}
- Read upRead up
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
*/
- Read upRead up
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,
Avoid too many return
statements within this method. Open
return $this->modx->lexicon('login_blocked_error');
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
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(
- Read upRead up
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"