core/UserManagement.php

Summary

Maintainability
C
7 hrs
Test Coverage

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
Severity: Minor
Found in core/UserManagement.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 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) {
Severity: Minor
Found in core/UserManagement.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 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
Severity: Minor
Found in core/UserManagement.php - About 1 hr to fix

    Method createTokens has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function createTokens($isByFedadmin, $for, $instIdentifier, $externalId = 0, $country = 0, $partType = 0)
    Severity: Minor
    Found in core/UserManagement.php - About 45 mins to fix

      Avoid too many return statements within this method.
      Open

              return self::TOKENSTATUS_FAIL_NONEXISTING;
      Severity: Major
      Found in core/UserManagement.php - About 30 mins to fix

        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);
        Severity: Minor
        Found in core/UserManagement.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