File Login.php
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Login Class
*
Method doLogIn
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doLogIn($email, $password, $rememberMe, $userIp, $userAgent){
// 1. check if user is blocked
if($this->isIpBlocked($userIp)) {
$this->errors[] = "Your IP Address has been blocked";
Method register
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register($name, $email, $password, $confirmPassword, $captcha){
$isValid = true;
$validation = new Validation();
Method isEmailVerificationTokenValid
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isEmailVerificationTokenValid($userId, $emailToken){
if (empty($userId) || empty($emailToken)) {
return false;
}
Function isEmailVerificationTokenValid
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function isEmailVerificationTokenValid($userId, $emailToken){
if (empty($userId) || empty($emailToken)) {
return false;
}
- 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 isForgottenPasswordTokenValid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function isForgottenPasswordTokenValid($userId, $passwordToken){
if (empty($userId) || empty($passwordToken)) {
return false;
}
- 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 register
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function register($name, $email, $password, $confirmPassword, $captcha){
Method doLogIn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function doLogIn($email, $password, $rememberMe, $userIp, $userAgent){
Function doLogIn
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function doLogIn($email, $password, $rememberMe, $userIp, $userAgent){
// 1. check if user is blocked
if($this->isIpBlocked($userIp)) {
$this->errors[] = "Your IP Address has been blocked";
- 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
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;