src/models/Users.php
File Users.php
has 542 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* @author Nicolas CARPi <nico-git@deltablot.email>
* @copyright 2012 Nicolas CARPi
Users
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Users implements RestInterface
{
public bool $needValidation = false;
public array $userData = array();
Method createOne
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createOne(
string $email,
array $teams,
string $firstname = '',
string $lastname = '',
Method readFromQuery
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function readFromQuery(
string $query,
int $teamId = 0,
bool $includeArchived = false,
bool $onlyAdmins = false,
Method patch
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function patch(Action $action, array $params): array
{
$this->canWriteOrExplode($action);
match ($action) {
Action::Add => (
Method update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function update(UserParams $params): bool
{
if ($params->getTarget() === 'password') {
throw new ImproperActionException('Use action:updatepassword to update the password');
}
Method createOne
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $email,
array $teams,
string $firstname = '',
string $lastname = '',
string $passwordHash = '',
Function update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
private function update(UserParams $params): bool
{
if ($params->getTarget() === 'password') {
throw new ImproperActionException('Use action:updatepassword to update the password');
}
- 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 createOne
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function createOne(
string $email,
array $teams,
string $firstname = '',
string $lastname = '',
- 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"