detain/myadmin-vps-module

View on GitHub
src/Plugin.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method loadProcessing has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function loadProcessing(GenericEvent $event)
    {
        /**
         * @var \ServiceHandler $service
         */
Severity: Major
Found in src/Plugin.php - About 2 hrs to fix

    Method doSliceEnable has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
        {
            $deferUpgradeViaTicket = true;
            $serviceInfo = $serviceOrder->getServiceInfo();
            $serviceTypes = run_event('get_service_types', false, self::$module);
    Severity: Minor
    Found in src/Plugin.php - About 1 hr to fix

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

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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

      Missing class import via use statement (line '125', column '22').
      Open

              $addon = new \AddonHandler();
      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 '158', column '33').
      Open

              $repeatInvoiceObj = new \MyAdmin\Orm\Repeat_Invoice();
      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 '228', column '22').
      Open

                      (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/vps_reactivated.tpl');
      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 '224', column '31').
      Open

                      $smarty = new \TFSmarty();
      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 '167', column '27').
      Open

              $invoiceObj = new \MyAdmin\Orm\Invoice();
      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

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

                      $class = '\\MyAdmin\\Orm\\'.get_orm_class_from_table($settings['TABLE']);
      Severity: Minor
      Found in src/Plugin.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 excessively long variable names like $deferUpgradeViaTicket. Keep variable name length under 20.
      Open

              $deferUpgradeViaTicket = true;
      Severity: Minor
      Found in src/Plugin.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      The variable $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $repeat_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $repeat_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $inv_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $inv_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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 $slice_cost is not named in camelCase.
      Open

          public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
          {
              $deferUpgradeViaTicket = true;
              $serviceInfo = $serviceOrder->getServiceInfo();
              $serviceTypes = run_event('get_service_types', false, self::$module);
      Severity: Minor
      Found in src/Plugin.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

      There are no issues that match your filters.

      Category
      Status