SimplyAdmire/SimplyAdmire.CrowdConnector

View on GitHub

Showing 5 of 5 total issues

Function authenticate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function authenticate(TokenInterface $authenticationToken)
    {
        $credentials = $authenticationToken->getCredentials();
        $instanceOptions = $this->instances[$this->options['instance']];

Severity: Minor
Found in Classes/Provider/CrowdProvider.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

Method authenticate has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function authenticate(TokenInterface $authenticationToken)
    {
        $credentials = $authenticationToken->getCredentials();
        $instanceOptions = $this->instances[$this->options['instance']];

Severity: Major
Found in Classes/Provider/CrowdProvider.php - About 2 hrs to fix

    Function importInstance has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function importInstance($instanceIdentifier, $providerName, array $options)
        {
            $this->outputLine('Import %s for provider %s', [$instanceIdentifier, $providerName]);
    
            $crowdApiService = new CrowdApiService($instanceIdentifier);
    Severity: Minor
    Found in Classes/Command/CrowdCommandController.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

    Method importInstance has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function importInstance($instanceIdentifier, $providerName, array $options)
        {
            $this->outputLine('Import %s for provider %s', [$instanceIdentifier, $providerName]);
    
            $crowdApiService = new CrowdApiService($instanceIdentifier);
    Severity: Minor
    Found in Classes/Command/CrowdCommandController.php - About 1 hr to fix

      Method doRequest has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function doRequest($uri, array $data = [])
          {
              try {
                  $url = \sprintf(
                      '%s/rest/usermanagement/%s/%s',
      Severity: Minor
      Found in Classes/Service/CrowdApiService.php - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language