detain/cpanel-licensing

View on GitHub

Showing 8 of 8 total issues

File Cpanel.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Detain\Cpanel;

require_once __DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php';
Severity: Minor
Found in src/Cpanel.php - About 3 hrs to fix

    Cpanel has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Cpanel
    {
        public $format;
        public $curl;
        public $opts;
    Severity: Minor
    Found in src/Cpanel.php - About 2 hrs to fix

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

          private function get($function, $args = [])
          {
              if (!$function) {
                  error_log('cPanelLicensing::get requires that a function is defined');
                  return;
      Severity: Minor
      Found in src/Cpanel.php - About 1 hr to fix

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

            private function formatResult($result)
            {
                if (is_array($result)) {
                    foreach ($result as $key => $value) {
                        if (is_array($value)) {
        Severity: Minor
        Found in src/Cpanel.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 findKey has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function findKey($search, $xmlObj)
            {
                $xmlObj = (array) $xmlObj;
                if (array_key_exists('packages', $xmlObj)) {
                    $type = 'packages';
        Severity: Minor
        Found in src/Cpanel.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

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

            private function get($function, $args = [])
            {
                if (!$function) {
                    error_log('cPanelLicensing::get requires that a function is defined');
                    return;
        Severity: Minor
        Found in src/Cpanel.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 $this->get('XMLtransferRequest.cgi', $args);
        Severity: Major
        Found in src/Cpanel.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->get('XMLlicenseAdd.cgi', $args);
          Severity: Major
          Found in src/Cpanel.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language