strausmann/hetznerrobot-php-client

View on GitHub

Showing 11 of 96 total issues

RobotClient has 109 functions (exceeds 20 allowed). Consider refactoring.
Open

class RobotClient extends RobotRestClient
{
  const VERSION = '2018.06';

  /**
Severity: Major
Found in src/RobotClient.php - About 2 days to fix

    File RobotClient.php has 708 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Client class for robot webservice
     *
    Severity: Major
    Found in src/RobotClient.php - About 1 day to fix

      Method orderServer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public function orderServer($productId, $location, array $authorizedKeys = array(), $password = null, $dist = null, $arch = null, $lang = null, $test = false)
        {
          $url = $this->baseUrl . '/order/server/transaction';
          $data = array('product_id' => $productId);
          $data['location'] = $location;
      Severity: Minor
      Found in src/RobotClient.php - About 1 hr to fix

        Method orderServer has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          public function orderServer($productId, $location, array $authorizedKeys = array(), $password = null, $dist = null, $arch = null, $lang = null, $test = false)
        Severity: Major
        Found in src/RobotClient.php - About 1 hr to fix

          Method linuxActivate has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            public function linuxActivate($ip, $dist, $arch, $lang, array $authorizedKeys = array())
          Severity: Minor
          Found in src/RobotClient.php - About 35 mins to fix

            Method cpanelActivate has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              public function cpanelActivate($ip, $dist, $arch, $lang, $hostname)
            Severity: Minor
            Found in src/RobotClient.php - About 35 mins to fix

              Method pleskActivate has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                public function pleskActivate($ip, $dist, $arch, $lang, $hostname)
              Severity: Minor
              Found in src/RobotClient.php - About 35 mins to fix

                Method firewallCreateOrUpdate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  public function firewallCreateOrUpdate($ip, $status, $whitelistHos, array $rules, $port = 'main')
                Severity: Minor
                Found in src/RobotClient.php - About 35 mins to fix

                  Method firewallTemplateUpdate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    public function firewallTemplateUpdate($templateId, $name, $whitelistHos, $isDefault, $rules)
                  Severity: Minor
                  Found in src/RobotClient.php - About 35 mins to fix

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

                      protected function executeRequest()
                      {
                        $result = parent::executeRequest();
                    
                        if ($result['response'] === false)
                    Severity: Minor
                    Found in src/RobotClient.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 orderServer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public function orderServer($productId, $location, array $authorizedKeys = array(), $password = null, $dist = null, $arch = null, $lang = null, $test = false)
                      {
                        $url = $this->baseUrl . '/order/server/transaction';
                        $data = array('product_id' => $productId);
                        $data['location'] = $location;
                    Severity: Minor
                    Found in src/RobotClient.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

                    Severity
                    Category
                    Status
                    Source
                    Language