core/Federation.php

Summary

Maintainability
D
2 days
Test Coverage

File Federation.php has 334 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * *****************************************************************************
 * Contributions to this work were made on behalf of the GÉANT project, a 
Severity: Minor
Found in core/Federation.php - About 4 hrs to fix

    Method newIdP has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function newIdP($type, $ownerId, $level, $mail = NULL, $bestnameguess = NULL)
        {
            $this->databaseHandle->exec("INSERT INTO institution (country, type) VALUES('$this->tld', '$type')");
            $identifier = $this->databaseHandle->lastID();
    
    
    Severity: Minor
    Found in core/Federation.php - About 2 hrs to fix

      Function listExternalEntities has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function listExternalEntities($unmappedOnly, $type = NULL)
          {
              $allExternals = [];
              $usedarray = [];
              $returnarray = [];
      Severity: Minor
      Found in core/Federation.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 __construct has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct($fedname)
          {
      
              // initialise the superclass variables
      
      
      Severity: Minor
      Found in core/Federation.php - About 1 hr to fix

        Function newIdP has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function newIdP($type, $ownerId, $level, $mail = NULL, $bestnameguess = NULL)
            {
                $this->databaseHandle->exec("INSERT INTO institution (country, type) VALUES('$this->tld', '$type')");
                $identifier = $this->databaseHandle->lastID();
        
        
        Severity: Minor
        Found in core/Federation.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 downloadStats has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function downloadStats($format)
            {
                $data = $this->downloadStatsCore();
                $retstring = "";
        
        
        Severity: Minor
        Found in core/Federation.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 listIdentityProviders has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function listIdentityProviders($activeOnly = 0)
            {
                // maybe we did this exercise before?
                if ($activeOnly != 0 && count($this->idpListActive) > 0) {
                    return $this->idpListActive;
        Severity: Minor
        Found in core/Federation.php - About 1 hr to fix

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

              public function listExternalEntities($unmappedOnly, $type = NULL)
              {
                  $allExternals = [];
                  $usedarray = [];
                  $returnarray = [];
          Severity: Minor
          Found in core/Federation.php - About 1 hr to fix

            Method downloadStats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function downloadStats($format)
                {
                    $data = $this->downloadStatsCore();
                    $retstring = "";
            
            
            Severity: Minor
            Found in core/Federation.php - About 1 hr to fix

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

                  public function newIdP($type, $ownerId, $level, $mail = NULL, $bestnameguess = NULL)
              Severity: Minor
              Found in core/Federation.php - About 35 mins to fix

                Function listIdentityProviders has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function listIdentityProviders($activeOnly = 0)
                    {
                        // maybe we did this exercise before?
                        if ($activeOnly != 0 && count($this->idpListActive) > 0) {
                            return $this->idpListActive;
                Severity: Minor
                Found in core/Federation.php - About 35 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