detain/myadmin-cpanel-licensing

View on GitHub
src/cpanel.inc.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method deactivate_cpanel has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deactivate_cpanel($ipAddress = false)
{
    if ($GLOBALS['tf']->ima == 'admin' && $ipAddress === false && isset($GLOBALS['tf']->variables->request['ip'])) {
        $ipAddress = $GLOBALS['tf']->variables->request['ip'];
    }
Severity: Minor
Found in src/cpanel.inc.php - About 1 hr to fix

    Function deactivate_cpanel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function deactivate_cpanel($ipAddress = false)
    {
        if ($GLOBALS['tf']->ima == 'admin' && $ipAddress === false && isset($GLOBALS['tf']->variables->request['ip'])) {
            $ipAddress = $GLOBALS['tf']->variables->request['ip'];
        }
    Severity: Minor
    Found in src/cpanel.inc.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

    Avoid too many return statements within this method.
    Open

        return false;
    Severity: Major
    Found in src/cpanel.inc.php - About 30 mins to fix

      Missing class import via use statement (line '23', column '16').
      Open

          $cpl = new \Detain\Cpanel\Cpanel(CPANEL_LICENSING_USERNAME, CPANEL_LICENSING_PASSWORD);
      Severity: Minor
      Found in src/cpanel.inc.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 '28').
      Open

                  $smartyE = new TFSmarty();
      Severity: Minor
      Found in src/cpanel.inc.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 '170', column '16').
      Open

          $cpl = new \Detain\Cpanel\Cpanel(CPANEL_LICENSING_USERNAME, CPANEL_LICENSING_PASSWORD);
      Severity: Minor
      Found in src/cpanel.inc.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 '108', column '16').
      Open

          $cpl = new \Detain\Cpanel\Cpanel(CPANEL_LICENSING_USERNAME, CPANEL_LICENSING_PASSWORD);
      Severity: Minor
      Found in src/cpanel.inc.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 '91', column '10').
      Open

          (new \MyAdmin\Mail())->adminMail($subject, $msg, false, 'client/client_email.tpl');
      Severity: Minor
      Found in src/cpanel.inc.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 '55', column '16').
      Open

          $cpl = new \Detain\Cpanel\Cpanel(CPANEL_LICENSING_USERNAME, CPANEL_LICENSING_PASSWORD);
      Severity: Minor
      Found in src/cpanel.inc.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 '79', column '18').
      Open

                  (new \MyAdmin\Mail())->adminMail($subject, $msg, false, 'client/client_email.tpl');
      Severity: Minor
      Found in src/cpanel.inc.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 '155', column '16').
      Open

          $cpl = new \Detain\Cpanel\Cpanel(CPANEL_LICENSING_USERNAME, CPANEL_LICENSING_PASSWORD);
      Severity: Minor
      Found in src/cpanel.inc.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 '87', column '20').
      Open

          $smartyE = new TFSmarty();
      Severity: Minor
      Found in src/cpanel.inc.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

      There are no issues that match your filters.

      Category
      Status