core/DeviceConfig.php

Summary

Maintainability
D
2 days
Test Coverage

File DeviceConfig.php has 436 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/DeviceConfig.php - About 6 hrs to fix

    DeviceConfig has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class DeviceConfig extends \core\common\Entity
    {
    
        /**
         * stores the path to the temporary working directory for a module instance
    Severity: Minor
    Found in core/DeviceConfig.php - About 2 hrs to fix

      Function getNetworks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getNetworks()
          {
              $additionalConsortia = [];
              $additionalSSIDs = [];
              $ssids = $this->getConfigSSIDs();
      Severity: Minor
      Found in core/DeviceConfig.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 setup has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          final public function setup(AbstractProfile $profile, $token = NULL, $importPassword = NULL, $openRoaming = 0)
          {
              $this->loggerInstance->debug(4, "module setup start\n");
              common\Entity::intoThePotatoes();
              $purpose = 'installer';
      Severity: Major
      Found in core/DeviceConfig.php - About 2 hrs to fix

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

            final public function setup(AbstractProfile $profile, $token = NULL, $importPassword = NULL, $openRoaming = 0)
            {
                $this->loggerInstance->debug(4, "module setup start\n");
                common\Entity::intoThePotatoes();
                $purpose = 'installer';
        Severity: Minor
        Found in core/DeviceConfig.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 longestNameSuffix has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function longestNameSuffix()
            {
                // for all configured server names, find the string that is the longest
                // suffix to all of them
                $longestSuffix = "";
        Severity: Minor
        Found in core/DeviceConfig.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 saveCertificateFiles has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            final protected function saveCertificateFiles($format)
            {
                switch ($format) {
                    case "der": // fall-thorugh, same treatment
                    case "pem":
        Severity: Minor
        Found in core/DeviceConfig.php - About 1 hr to fix

          Method getNetworks has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getNetworks()
              {
                  $additionalConsortia = [];
                  $additionalSSIDs = [];
                  $ssids = $this->getConfigSSIDs();
          Severity: Minor
          Found in core/DeviceConfig.php - About 1 hr to fix

            Function getSSIDs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getSSIDs()
                {
                    $ssidList = [];
                    $ssidList['add'] = [];
                    $ssidList['del'] = [];
            Severity: Minor
            Found in core/DeviceConfig.php - About 55 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

            Function getInstallerBasename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getInstallerBasename()
                {
                    $baseName = $this->customTranslit(\config\ConfAssistant::CONSORTIUM['name'])."-".$this->getDeviceId();
                    if (isset($this->attributes['profile:customsuffix'][1])) {
                        // this string will end up as a filename on a filesystem, so always
            Severity: Minor
            Found in core/DeviceConfig.php - About 45 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

            Function saveCertificateFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                final protected function saveCertificateFiles($format)
                {
                    switch ($format) {
                        case "der": // fall-thorugh, same treatment
                        case "pem":
            Severity: Minor
            Found in core/DeviceConfig.php - About 45 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

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

                private function getConsortia()
                {
            
                    if (!isset(\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi'])) {
                        return ([]);
            Severity: Minor
            Found in core/DeviceConfig.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

            Function saveLogoFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function saveLogoFile($logos, $type)
                {
                    $iterator = 0;
                    $returnarray = [];
                    foreach ($logos as $blob) {
            Severity: Minor
            Found in core/DeviceConfig.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