detain/myadmin-plesk-webhosting

View on GitHub

Showing 102 of 102 total issues

File Plesk.php has 1971 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Detain\MyAdminPlesk;

use Detain\MyAdminPlesk\ApiRequestException;
Severity: Major
Found in src/Plesk.php - About 5 days to fix

    Function getActivate has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getActivate(GenericEvent $event)
        {
            if ($event['category'] == get_service_define('WEB_PLESK')) {
                $serviceClass = $event->getSubject();
                myadmin_log(self::$module, 'info', 'Plesk Activation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
    Severity: Minor
    Found in src/Plugin.php - About 2 days 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

    Plesk has 71 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Plesk
    {
        public $curl;
        private $host;
        private $login;
    Severity: Major
    Found in src/Plesk.php - About 1 day to fix

      Method getActivate has 216 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getActivate(GenericEvent $event)
          {
              if ($event['category'] == get_service_define('WEB_PLESK')) {
                  $serviceClass = $event->getSubject();
                  myadmin_log(self::$module, 'info', 'Plesk Activation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
      Severity: Major
      Found in src/Plugin.php - About 1 day to fix

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

        <?php
        
        namespace Detain\MyAdminPlesk;
        
        use Detain\MyAdminPlesk\ApiRequestException;
        Severity: Minor
        Found in src/Plugin.php - About 4 hrs to fix

          Method createSubscription has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function createSubscription($params)
              {
                  $required = [
                      'name',
                      'ip_address'
          Severity: Major
          Found in src/Plesk.php - About 4 hrs to fix

            Method createSite has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function createSite($params)
                {
                    $xmldoc = new \DomDocument('1.0', 'UTF-8');
                    $xmldoc->formatOutput = true;
                    $packet = $xmldoc->createElement('packet');
            Severity: Major
            Found in src/Plesk.php - About 3 hrs to fix

              Function createSite has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function createSite($params)
                  {
                      $xmldoc = new \DomDocument('1.0', 'UTF-8');
                      $xmldoc->formatOutput = true;
                      $packet = $xmldoc->createElement('packet');
              Severity: Minor
              Found in src/Plesk.php - About 3 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 createSubscription has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function createSubscription($params)
                  {
                      $required = [
                          'name',
                          'ip_address'
              Severity: Minor
              Found in src/Plesk.php - About 3 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 getSites has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getSites($params = false)
                  {
                      if ($params === false) {
                          $params = [];
                      }
              Severity: Minor
              Found in src/Plesk.php - About 3 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

              File test.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
              * Plesk Test
              *
              * This file attempts the following operations on a real Plesk server (intended to be run by an admin account)
              Severity: Minor
              Found in bin/test.php - About 2 hrs to fix

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

                    public function listSubscriptions($params = false)
                    {
                        if ($params === false) {
                            $params = [];
                        }
                Severity: Minor
                Found in src/Plesk.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 getSites has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getSites($params = false)
                    {
                        if ($params === false) {
                            $params = [];
                        }
                Severity: Major
                Found in src/Plesk.php - About 2 hrs to fix

                  Method updateClient has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function updateClient($params)
                      {
                          $xmldoc = new \DomDocument('1.0', 'UTF-8');
                          $xmldoc->formatOutput = true;
                          $packet = $xmldoc->createElement('packet');
                  Severity: Major
                  Found in src/Plesk.php - About 2 hrs to fix

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

                        public function updateClient($params)
                        {
                            $xmldoc = new \DomDocument('1.0', 'UTF-8');
                            $xmldoc->formatOutput = true;
                            $packet = $xmldoc->createElement('packet');
                    Severity: Minor
                    Found in src/Plesk.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 listSubscriptions has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function listSubscriptions($params = false)
                        {
                            if ($params === false) {
                                $params = [];
                            }
                    Severity: Major
                    Found in src/Plesk.php - About 2 hrs to fix

                      Method createClient has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function createClient($data)
                          {
                              $xmldoc = new \DomDocument('1.0', 'UTF-8');
                              $xmldoc->formatOutput = true;
                              $packet = $xmldoc->createElement('packet');
                      Severity: Minor
                      Found in src/Plesk.php - About 1 hr to fix

                        Method updateSite has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function updateSite($params)
                            {
                                $xmldoc = new \DomDocument('1.0', 'UTF-8');
                                $xmldoc->formatOutput = true;
                                $packet = $xmldoc->createElement('packet');
                        Severity: Minor
                        Found in src/Plesk.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                          if (is_numeric($key) && is_array($value) && count($value) == 2 && isset($value['name']) && isset($value['value'])) {
                                              unset($result[$key]);
                                              $result[$value['name']] = $value['value'];
                                          } elseif (is_numeric($key) && is_array($value) && count($value) == 2 && isset($value['name']) && isset($value['version'])) {
                                              unset($result[$key]);
                          Severity: Critical
                          Found in src/Plesk.php - About 1 hr to fix

                            Method deleteSubscription has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function deleteSubscription($params)
                                {
                                    $xmldoc = new \DomDocument('1.0', 'UTF-8');
                                    $xmldoc->formatOutput = true;
                                    $packet = $xmldoc->createElement('packet');
                            Severity: Minor
                            Found in src/Plesk.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language