detain/myadmin-softaculous-licensing

View on GitHub

Showing 108 of 108 total issues

Missing class import via use statement (line '141', column '24').
Open

            $noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(SOFTACULOUS_USERNAME, SOFTACULOUS_PASSWORD);
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 '13', column '22').
Open

        $table = new \TFTable();
Severity: Minor
Found in src/softaculous_list.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 '16', column '20').
Open

        $noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(WEBUZO_USERNAME, WEBUZO_PASSWORD);
Severity: Minor
Found in src/webuzo_list.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 '16', column '20').
Open

        $noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(SOFTACULOUS_USERNAME, SOFTACULOUS_PASSWORD);
Severity: Minor
Found in src/softaculous_list.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 '75', column '24').
Open

            $xml = new \SimpleXMLElement($xml);
Severity: Minor
Found in src/ArrayToXML.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

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

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

Avoid unused local variables such as '$need'.
Open

                    $need = false;
Severity: Minor
Found in src/activate_webuzo.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$k'.
Open

            foreach ($logs['actions'] as $k => $v) {
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$k'.
Open

            foreach ($logs['actions'] as $k => $v) {
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$k'.
Open

            foreach ($logs['actions'] as $k => $v) {
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$ipAddress'.
Open

        $licenses =  $noc->webuzo_licenses('', $ipAddress);
Severity: Minor
Found in src/webuzo_list.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$ipAddress'.
Open

        $licenses = $noc->licenses('', $ipAddress);
Severity: Minor
Found in src/softaculous_list.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

class SoftaculousNOC
{
    private $nocname = 'username';
    private $nocpass = 'password';
    public $softaculous = 'https://www.softaculous.com/noc';
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

Avoid unused local variables such as '$return'.
Open

        $return = $response['license'];
Severity: Minor
Found in src/activate_softaculous.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$response'.
Open

        myadmin_log('licenses', 'info', '<pre>'.json_encode($response).'</pre>', __LINE__, __FILE__);
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$k'.
Open

            foreach ($logs['actions'] as $k => $v) {
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The function activate_webuzo() calls the typical debug function print_r() which is mostly only used during development.
Open

            myadmin_log('myadmin', 'debug', 'webuzoBuy error:'.print_r($noc->error, true), __LINE__, __FILE__);
Severity: Minor
Found in src/activate_webuzo.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

The variable $my_lic is not named in camelCase.
Open

    public function webuzo_refund_and_cancel($key = '', $ip = '', $force = 0)
    {
        if (!empty($ip)) {
            // Search for a license
            $lic = $this->webuzo_licenses('', $ip);
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $max_length is not named in camelCase.
Open

function array2json($arr)
{
    if (function_exists('json_encode')) {
        return json_encode($arr);
    } //Lastest versions of PHP already has this functionality.
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $my_lic is not named in camelCase.
Open

    public function refund_and_cancel($key = '', $ip = '', $force = 0)
    {
        if (!empty($ip)) {
            // Search for a license
            $lic = $this->licenses('', $ip);
Severity: Minor
Found in src/SoftaculousNOC.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

Severity
Category
Status
Source
Language