devices/ms/WindowsCommon.php

Summary

Maintainability
C
1 day
Test Coverage

File WindowsCommon.php has 357 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 devices/ms/WindowsCommon.php - About 4 hrs to fix

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

        protected function writeNsisDefines($attr)
        {
            $fcontents = '';
            if ($attr['internal:profile_count'][0] > 1) {
                $fcontents .= "\n" . '!define USER_GROUP "' . $this->translateString(str_replace('"', '$\\"', $attr['profile:name'][0])) . '"
    Severity: Minor
    Found in devices/ms/WindowsCommon.php - About 1 hr to fix

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

          protected function msInfoFile($attr)
          {
              $out = '';
              if (isset($attr['support:info_file'])) {
                  $out .= '!define EXTERNAL_INFO "';
      Severity: Minor
      Found in devices/ms/WindowsCommon.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 combineLogo has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function combineLogo($logos = NULL, $fedLogo = NULL)
          {
              // maximum size to which we want to resize the logos
      
              $maxSize = 120;
      Severity: Minor
      Found in devices/ms/WindowsCommon.php - About 1 hr to fix

        Method writeDeviceInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function writeDeviceInfo()
            {
                \core\common\Entity::intoThePotatoes();
                $networkList = [];
                foreach (array_keys($this->getAttribute('internal:networks')) as $networkName) {
        Severity: Minor
        Found in devices/ms/WindowsCommon.php - About 1 hr to fix

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

              protected function combineLogo($logos = NULL, $fedLogo = NULL)
              {
                  // maximum size to which we want to resize the logos
          
                  $maxSize = 120;
          Severity: Minor
          Found in devices/ms/WindowsCommon.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 scaleLogo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function scaleLogo($imagePath, $maxSize)
              {
                  if (class_exists('\\Gmagick')) { 
                      $imageObject = new \Gmagick($imagePath); 
                  } else {
          Severity: Minor
          Found in devices/ms/WindowsCommon.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

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

              protected function writeNsisDefines($attr)
              {
                  $fcontents = '';
                  if ($attr['internal:profile_count'][0] > 1) {
                      $fcontents .= "\n" . '!define USER_GROUP "' . $this->translateString(str_replace('"', '$\\"', $attr['profile:name'][0])) . '"
          Severity: Minor
          Found in devices/ms/WindowsCommon.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