Function createIdPFromToken
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function createIdPFromToken(string $token, string $owner)
{
new CAT(); // be sure that Entity's static members are initialised
common\Entity::intoThePotatoes();
// the token either has cat_institution_id set -> new admin for existing inst
- 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 createTokens
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function createTokens($isByFedadmin, $for, $instIdentifier, $externalId = 0, $country = 0, $partType = 0)
{
$level = ($isByFedadmin ? "FED" : "INST");
$tokenList = [];
foreach ($for as $oneDest) {
- 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 createIdPFromToken
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createIdPFromToken(string $token, string $owner)
{
new CAT(); // be sure that Entity's static members are initialised
common\Entity::intoThePotatoes();
// the token either has cat_institution_id set -> new admin for existing inst
Method createTokens
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createTokens($isByFedadmin, $for, $instIdentifier, $externalId = 0, $country = 0, $partType = 0)
Avoid too many return
statements within this method. Open
return self::TOKENSTATUS_FAIL_NONEXISTING;
Function checkTokenValidity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function checkTokenValidity($token)
{
$check = $this->databaseHandle->exec("SELECT invite_token, cat_institution_id
FROM invitations
WHERE invite_token = ? AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0", "s", $token);
- 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"