detain/myadmin-hyperv-vps

View on GitHub

Showing 102 of 102 total issues

Method queueCreate has 422 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function queueCreate($serviceInfo)
    {
        $db = get_module_db(self::$module);
        $db2 = get_module_db(self::$module);
        $settings = get_module_settings(self::$module);
Severity: Major
Found in src/Plugin.php - About 2 days to fix

    Function queueCreate has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function queueCreate($serviceInfo)
        {
            $db = get_module_db(self::$module);
            $db2 = get_module_db(self::$module);
            $settings = get_module_settings(self::$module);
    Severity: Minor
    Found in src/Plugin.php - About 1 day 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

    File Plugin.php has 631 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Detain\MyAdminHyperv;
    
    require_once __DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php';
    Severity: Major
    Found in src/Plugin.php - About 1 day to fix

      Method getSoapCallParams has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getSoapCallParams($call, $serviceInfo)
          {
              if ($call == 'CleanUpResources') {
                  return [];
              } elseif ($call == 'ResizeVMHardDrive') {
      Severity: Major
      Found in src/Plugin.php - About 2 hrs to fix

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

            public static function getQueue(GenericEvent $event)
            {
                if (in_array($event['type'], [get_service_define('HYPERV')])) {
                    $serviceInfo = $event->getSubject();
                    $settings = get_module_settings(self::$module);
        Severity: Minor
        Found in src/Plugin.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 getQueue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getQueue(GenericEvent $event)
            {
                if (in_array($event['type'], [get_service_define('HYPERV')])) {
                    $serviceInfo = $event->getSubject();
                    $settings = get_module_settings(self::$module);
        Severity: Minor
        Found in src/Plugin.php - About 1 hr to fix

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

              public static function getSoapCallParams($call, $serviceInfo)
              {
                  if ($call == 'CleanUpResources') {
                      return [];
                  } elseif ($call == 'ResizeVMHardDrive') {
          Severity: Minor
          Found in src/Plugin.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

          Avoid too many return statements within this method.
          Open

                          return false;
          Severity: Major
          Found in src/Plugin.php - About 30 mins to fix

            Missing class import via use statement (line '392', column '29').
            Open

                            $soap = new \SoapClient($url, $params);
            Severity: Minor
            Found in src/Plugin.php by phpmd

            MissingImport

            Since: 2.7.0

            Importing all external classes in a file through use statements makes them clearly visible.

            Example

            function make() {
                return new \stdClass();
            }

            Source http://phpmd.org/rules/cleancode.html#MissingImport

            Missing class import via use statement (line '645', column '33').
            Open

                                $soap = new \SoapClient($url, $params);
            Severity: Minor
            Found in src/Plugin.php by phpmd

            MissingImport

            Since: 2.7.0

            Importing all external classes in a file through use statements makes them clearly visible.

            Example

            function make() {
                return new \stdClass();
            }

            Source http://phpmd.org/rules/cleancode.html#MissingImport

            Missing class import via use statement (line '699', column '25').
            Open

                        $soap = new \SoapClient($url, $params);
            Severity: Minor
            Found in src/Plugin.php by phpmd

            MissingImport

            Since: 2.7.0

            Importing all external classes in a file through use statements makes them clearly visible.

            Example

            function make() {
                return new \stdClass();
            }

            Source http://phpmd.org/rules/cleancode.html#MissingImport

            Avoid too many return statements within this method.
            Open

                        return [
                            'adminUser' => 'Administrator',
                            'adminPassword' => $serviceInfo['server_info']['vps_root'],
                            'vmId' => $serviceInfo['vps_vzid'],
                            'username' => 'Administrator',
            Severity: Major
            Found in src/Plugin.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return [
                              'vmId' => $serviceInfo['vps_vzid'],
                              'minimumOps' => VPS_SLICE_HYPERV_IO_MIN_BASE + (VPS_SLICE_HYPERV_IO_MIN_MULT * $serviceInfo['vps_slices']),
                              'maximumOps' => VPS_SLICE_HYPERV_IO_MAX_BASE + (VPS_SLICE_HYPERV_IO_MAX_MULT * $serviceInfo['vps_slices']),
                              'adminUsername' => 'Administrator',
              Severity: Major
              Found in src/Plugin.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false;
                Severity: Major
                Found in src/Plugin.php - About 30 mins to fix

                  Missing class import via use statement (line '362', column '29').
                  Open

                                  $soap = new \SoapClient($url, $params);
                  Severity: Minor
                  Found in src/Plugin.php by phpmd

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                  Missing class import via use statement (line '308', column '29').
                  Open

                                  $soap = new \SoapClient($url, $params);
                  Severity: Minor
                  Found in src/Plugin.php by phpmd

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                  Missing class import via use statement (line '338', column '25').
                  Open

                              $soap = new \SoapClient($url, $params);
                  Severity: Minor
                  Found in src/Plugin.php by phpmd

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                  Missing class import via use statement (line '552', column '29').
                  Open

                                  $soap = new \SoapClient($url, $params);
                  Severity: Minor
                  Found in src/Plugin.php by phpmd

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                  Avoid too many return statements within this method.
                  Open

                              return [
                                  'hyperVAdmin' => 'Administrator',
                                  'adminPassword' => $serviceInfo['server_info']['vps_root']
                              ];
                  Severity: Major
                  Found in src/Plugin.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return true;
                    Severity: Major
                    Found in src/Plugin.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language