detain/parallels-licensing

View on GitHub

Showing 6 of 6 total issues

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

    public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null)
    {
        if (null === $login && defined('PARALLELS_KA_LOGIN')) {
            $this->login = constant('PARALLELS_KA_LOGIN');
        } else {
Severity: Minor
Found in src/Parallels.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 getMainKeyFromIp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMainKeyFromIp($ipAddress)
    {
        $response = $this->getKeyNumbers($ipAddress);
        //$response = $this->getKeysInfoByIP($ipAddress);
        $return = false;
Severity: Minor
Found in src/Parallels.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 __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null)
    {
        if (null === $login && defined('PARALLELS_KA_LOGIN')) {
            $this->login = constant('PARALLELS_KA_LOGIN');
        } else {
Severity: Minor
Found in src/Parallels.php - About 1 hr to fix

    Method createKey has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false)
    Severity: Minor
    Found in src/Parallels.php - About 45 mins to fix

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

          public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null)
      Severity: Minor
      Found in src/Parallels.php - About 35 mins to fix

        The class Parallels has 1083 lines of code. Current threshold is 1000. Avoid really long classes.
        Open

        class Parallels
        {
            public $licenseType = 'billing'; // billing or purchase
            private $xmlOptions = ['sslverify' => false];
            private $defaultUrl = 'https://ka.parallels.com:7050/';
        Severity: Minor
        Found in src/Parallels.php by phpmd
        Severity
        Category
        Status
        Source
        Language