devices/apple_mobileconfig/MobileconfigSuperclass.php

Summary

Maintainability
D
3 days
Test Coverage

File MobileconfigSuperclass.php has 531 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: Major
Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 day to fix

    Method networkBlock has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function networkBlock($blocktype, $toBeConfigured, $prettyName)
        {
            \core\common\Entity::intoThePotatoes();
            $eapType = $this->selectedEap;
            switch ($blocktype) {
    Severity: Major
    Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 3 hrs to fix

      Method eapBlock has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function eapBlock($eapType)
          {
              $realm = $this->determineOuterIdString();
              $retval = "<key>EAPClientConfiguration</key>
                        <dict>
      Severity: Minor
      Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

        Method writeInstaller has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function writeInstaller()
            {
                \core\common\Entity::intoThePotatoes();
        
                $this->loggerInstance->debug(4, "mobileconfig Module Installer start\n");
        Severity: Minor
        Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

          Method caBlob has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function caBlob($ca)
              {
                  \core\common\Entity::intoThePotatoes();
                  $stream = "";
                  if (!in_array($ca['uuid'], $this->CAsAccountedFor)) { // skip if this is a duplicate
          Severity: Minor
          Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

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

                private function allNetworkBlocks()
                {
                    $retval = "";
                    $this->serial = 0;
                    $this->loggerInstance->debug(3, $this->attributes['internal:networks'], "NETWORKS:\n", "\n");
            Severity: Minor
            Found in devices/apple_mobileconfig/MobileconfigSuperclass.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 networkBlock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                private function networkBlock($blocktype, $toBeConfigured, $prettyName)
                {
                    \core\common\Entity::intoThePotatoes();
                    $eapType = $this->selectedEap;
                    switch ($blocktype) {
            Severity: Minor
            Found in devices/apple_mobileconfig/MobileconfigSuperclass.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 clientP12Block has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function clientP12Block()
                {
                    \core\common\Entity::intoThePotatoes();
                    if (count($this->clientCert) == 0) {
                        throw new Exception("the client block was called but there is no client certificate!");
            Severity: Minor
            Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

              Method removenetworkBlock has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function removenetworkBlock($ssid)
                  {
                      \core\common\Entity::intoThePotatoes();
                      $retval = "
              <dict>
              Severity: Minor
              Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

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

                    public function writeDeviceInfo()
                    {
                        \core\common\Entity::intoThePotatoes();
                        $ssidCount = 0;
                        $oiCount = 0;
                Severity: Minor
                Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 1 hr to fix

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

                      protected function consentBlock()
                      {
                          \core\common\Entity::intoThePotatoes();
                          if (isset($this->attributes['support:info_file'])) {
                              return MobileconfigSuperclass::BUFFER_CONSENT_PRE . htmlspecialchars(iconv("UTF-8", "UTF-8//TRANSLIT", $this->attributes['support:info_file'][0]), ENT_XML1, 'UTF-8') . MobileconfigSuperclass::BUFFER_CONSENT_POST;
                  Severity: Minor
                  Found in devices/apple_mobileconfig/MobileconfigSuperclass.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

                  Avoid too many return statements within this method.
                  Open

                          return "";
                  Severity: Major
                  Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 30 mins to fix

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

                        private function eapBlock($eapType)
                        {
                            $realm = $this->determineOuterIdString();
                            $retval = "<key>EAPClientConfiguration</key>
                                      <dict>
                    Severity: Minor
                    Found in devices/apple_mobileconfig/MobileconfigSuperclass.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