core/IdPlist.php

Summary

Maintainability
D
1 day
Test Coverage

File IdPlist.php has 283 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/IdPlist.php - About 2 hrs to fix

    Function listAllIdentityProviders has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function listAllIdentityProviders($activeOnly = 0, $country = "")
        {
            common\Entity::intoThePotatoes();
            $handle = DBConnection::handle("INST");
            $handle->exec("SET SESSION group_concat_max_len=10000");
    Severity: Minor
    Found in core/IdPlist.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 listIdentityProvidersWithProfiles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function listIdentityProvidersWithProfiles() {
            $handle = DBConnection::handle("INST");
            $handle->exec("SET SESSION group_concat_max_len=10000");
            $idpQuery = IdPlist::setAllIdentyProvidersQuery(1);
            $allIDPs = $handle->exec($idpQuery);
    Severity: Minor
    Found in core/IdPlist.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 getIdpDistance has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function getIdpDistance($idp, $location)
        {
            $dist = 10000;
            if (isset($idp['geo'])) {
                $G = $idp['geo'];
    Severity: Minor
    Found in core/IdPlist.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 listIdentityProvidersWithProfiles has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function listIdentityProvidersWithProfiles() {
            $handle = DBConnection::handle("INST");
            $handle->exec("SET SESSION group_concat_max_len=10000");
            $idpQuery = IdPlist::setAllIdentyProvidersQuery(1);
            $allIDPs = $handle->exec($idpQuery);
    Severity: Minor
    Found in core/IdPlist.php - About 1 hr to fix

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

          public static function listAllIdentityProviders($activeOnly = 0, $country = "")
          {
              common\Entity::intoThePotatoes();
              $handle = DBConnection::handle("INST");
              $handle->exec("SET SESSION group_concat_max_len=10000");
      Severity: Minor
      Found in core/IdPlist.php - About 1 hr to fix

        Method setProfileAttributes has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static function setProfileAttributes($profile)
            {
                $profileOptions = explode('---', $profile->profile_options);
                $productionProfile = false;
                $profileNames = [];
        Severity: Minor
        Found in core/IdPlist.php - About 1 hr to fix

          Function setProfileAttributes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function setProfileAttributes($profile)
              {
                  $profileOptions = explode('---', $profile->profile_options);
                  $productionProfile = false;
                  $profileNames = [];
          Severity: Minor
          Found in core/IdPlist.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 setIdentityProviderAttributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function setIdentityProviderAttributes($idp) {
                  $options = explode('---', $idp->options);
                  $names = [];
                  $geo = [];
                  $icon = 0;
          Severity: Minor
          Found in core/IdPlist.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