DerDu/SPHERE-Framework

View on GitHub
Application/Platform/Gatekeeper/Authorization/Account/Service.php

Summary

Maintainability
F
4 days
Test Coverage

File Service.php has 495 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace SPHERE\Application\Platform\Gatekeeper\Authorization\Account;

use SPHERE\Application\People\Person\Service\Entity\TblPerson;
use SPHERE\Application\Platform\Gatekeeper\Authorization\Access\Service\Entity\TblRole;
Severity: Minor
Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 7 hrs to fix

    Service has 51 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Service extends AbstractService
    {
    
        /** @var TblAccount[] $AccountByIdCache */
        private static $AccountByIdCache = array();
    Severity: Major
    Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 7 hrs to fix

      Function isCredentialValid has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          private function isCredentialValid($Username, $Password, $TokenString, TblIdentification $tblIdentification)
          {
      
              if (false === ($tblAccount = $this->getAccountByCredential($Username, $Password, $tblIdentification))) {
                  return false;
      Severity: Minor
      Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 5 hrs 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 createSessionCredentialToken has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createSessionCredentialToken(
              IFormInterface &$Form,
              $CredentialName,
              $CredentialLock,
              $CredentialKey,
      Severity: Minor
      Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 3 hrs 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 createSessionCredential has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createSessionCredential(
              IFormInterface &$Form,
              $CredentialName,
              $CredentialLock,
              TblIdentification $tblIdentification
      Severity: Minor
      Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 2 hrs 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 editGroup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function editGroup(
              IFormInterface $Form,
              TblGroup $tblGroup,
              $Group,
              Pipeline $pipelineSuccess = null
      Severity: Minor
      Found in Application/Platform/Gatekeeper/Authorization/Account/Service.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 editGroup has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function editGroup(
              IFormInterface $Form,
              TblGroup $tblGroup,
              $Group,
              Pipeline $pipelineSuccess = null
      Severity: Minor
      Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 1 hr to fix

        Function createGroup has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createGroup(
                IFormInterface $Form,
                $Group,
                Pipeline $pipelineSuccess = null
            )
        Severity: Minor
        Found in Application/Platform/Gatekeeper/Authorization/Account/Service.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 createGroup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createGroup(
                IFormInterface $Form,
                $Group,
                Pipeline $pipelineSuccess = null
            )
        Severity: Minor
        Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 1 hr to fix

          Method isCredentialValid has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function isCredentialValid($Username, $Password, $TokenString, TblIdentification $tblIdentification)
              {
          
                  if (false === ($tblAccount = $this->getAccountByCredential($Username, $Password, $tblIdentification))) {
                      return false;
          Severity: Minor
          Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 1 hr to fix

            Method createSessionCredentialToken has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createSessionCredentialToken(
                    IFormInterface &$Form,
                    $CredentialName,
                    $CredentialLock,
                    $CredentialKey,
            Severity: Minor
            Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 1 hr to fix

              Method createSessionCredential has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createSessionCredential(
                      IFormInterface &$Form,
                      $CredentialName,
                      $CredentialLock,
                      TblIdentification $tblIdentification
              Severity: Minor
              Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 1 hr to fix

                Method insertAccount has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function insertAccount($Username, $Password, TblToken $tblToken = null, TblConsumer $tblConsumer = null, $SaveInitialPW = false)
                Severity: Minor
                Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 35 mins to fix

                  Method createSessionCredentialToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          IFormInterface &$Form,
                          $CredentialName,
                          $CredentialLock,
                          $CredentialKey,
                          TblIdentification $tblIdentification
                  Severity: Minor
                  Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 35 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                            return null;
                    Severity: Major
                    Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return null;
                      Severity: Major
                      Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                        return null;
                        Severity: Major
                        Found in Application/Platform/Gatekeeper/Authorization/Account/Service.php - About 30 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status