detain/myadmin-cpanel-licensing

View on GitHub

Showing 30 of 30 total issues

Function unbilled_cpanel has a Cognitive Complexity of 133 (exceeds 5 allowed). Consider refactoring.
Open

function unbilled_cpanel()
{
    function_requirements('has_acl');
    if ($GLOBALS['tf']->ima != 'admin' || !has_acl('view_service')) {
        dialog('Not admin', 'Not Admin or you lack the permissions to view this page.');
Severity: Minor
Found in src/unbilled_cpanel.php - About 2 days 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 unbilled_cpanel has 202 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function unbilled_cpanel()
{
    function_requirements('has_acl');
    if ($GLOBALS['tf']->ima != 'admin' || !has_acl('view_service')) {
        dialog('Not admin', 'Not Admin or you lack the permissions to view this page.');
Severity: Major
Found in src/unbilled_cpanel.php - About 1 day to fix

    Method cpanel_ksplice_addon has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function cpanel_ksplice_addon()
    {
        page_title('CPanel KSplice Addon');
        $settings = \get_module_settings('licenses');
        $db = get_module_db('licenses');
    Severity: Major
    Found in src/cpanel_ksplice_addon.php - About 2 hrs to fix

      Function cpanel_kcare_addon has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function cpanel_kcare_addon()
      {
          page_title('CPanel KCare Addon');
          $settings = \get_module_settings('licenses');
          $db = get_module_db('licenses');
      Severity: Minor
      Found in src/cpanel_kcare_addon.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 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

        Method cpanel_kcare_addon has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function cpanel_kcare_addon()
        {
            page_title('CPanel KCare Addon');
            $settings = \get_module_settings('licenses');
            $db = get_module_db('licenses');
        Severity: Minor
        Found in src/cpanel_kcare_addon.php - About 1 hr to fix

          Function cpanel_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function cpanel_list()
          {
              page_title('CPanel License List');
              if ($GLOBALS['tf']->ima == 'admin') {
                  $table = new \TFTable();
          Severity: Minor
          Found in src/cpanel_list.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 cpanel_ksplice_addon has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          function cpanel_ksplice_addon()
          {
              page_title('CPanel KSplice Addon');
              $settings = \get_module_settings('licenses');
              $db = get_module_db('licenses');
          Severity: Minor
          Found in src/cpanel_ksplice_addon.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 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

          Function getDeactivate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

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

          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 '45', column '16').
          Open

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

          Remove error control operator '@' on line 72.
          Open

              public static function getDeactivate(GenericEvent $event)
              {
                  $serviceClass = $event->getSubject();
                  if ($event['category'] == get_service_define('CPANEL')) {
                      myadmin_log(self::$module, 'info', 'cPanel Deactivation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
          Severity: Minor
          Found in src/Plugin.php by phpmd

          ErrorControlOperator

          Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

          Example

          function foo($filePath) {
              $file = @fopen($filPath); // hides exceptions
              $key = @$array[$notExistingKey]; // assigns null to $key
          }

          Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

          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

          Remove error control operator '@' on line 48.
          Open

          function cpanel_kcare_addon()
          {
              page_title('CPanel KCare Addon');
              $settings = \get_module_settings('licenses');
              $db = get_module_db('licenses');
          Severity: Minor
          Found in src/cpanel_kcare_addon.php by phpmd

          ErrorControlOperator

          Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

          Example

          function foo($filePath) {
              $file = @fopen($filPath); // hides exceptions
              $key = @$array[$notExistingKey]; // assigns null to $key
          }

          Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

          Missing class import via use statement (line '38', column '26').
          Open

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

                      $table = new \TFTable();
          Severity: Minor
          Found in src/cpanel_ksplice_addon.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

          Severity
          Category
          Status
          Source
          Language