detain/myadmin-pleskautomation-webhosting

View on GitHub
src/Plugin.php

Summary

Maintainability
D
2 days
Test Coverage

Method getActivate has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getActivate(GenericEvent $event)
    {
        if ($event['category'] == get_service_define('WEB_PPA')) {
            $serviceClass = $event->getSubject();
            myadmin_log(self::$module, 'info', 'PleskAutomation Activation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
Severity: Major
Found in src/Plugin.php - About 5 hrs to fix

    File Plugin.php has 324 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Detain\MyAdminPleskAutomation;
    
    use Detain\MyAdminPleskAutomation\PPAConnector;
    Severity: Minor
    Found in src/Plugin.php - About 3 hrs to fix

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

          public static function getActivate(GenericEvent $event)
          {
              if ($event['category'] == get_service_define('WEB_PPA')) {
                  $serviceClass = $event->getSubject();
                  myadmin_log(self::$module, 'info', 'PleskAutomation Activation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
      Severity: Minor
      Found in src/Plugin.php - About 2 hrs 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 getTerminate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getTerminate(GenericEvent $event)
          {
              if ($event['category'] == get_service_define('WEB_PPA')) {
                  $event->stopPropagation();
                  $serviceClass = $event->getSubject();
      Severity: Minor
      Found in src/Plugin.php - About 1 hr to fix

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

            public static function getTerminate(GenericEvent $event)
            {
                if ($event['category'] == get_service_define('WEB_PPA')) {
                    $event->stopPropagation();
                    $serviceClass = $event->getSubject();
        Severity: Minor
        Found in src/Plugin.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 getDeactivate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getDeactivate(GenericEvent $event)
            {
                if ($event['category'] == get_service_define('WEB_PPA')) {
                    $serviceClass = $event->getSubject();
                    myadmin_log(self::$module, 'info', 'PleskAutomation Deactivation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
        Severity: Minor
        Found in src/Plugin.php - About 1 hr to fix

          Method getReactivate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getReactivate(GenericEvent $event)
              {
                  if ($event['category'] == get_service_define('WEB_PPA')) {
                      $serviceClass = $event->getSubject();
                      $serverdata = get_service_master($serviceClass->getServer(), self::$module);
          Severity: Minor
          Found in src/Plugin.php - About 1 hr to fix

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

                public static function getDeactivate(GenericEvent $event)
                {
                    if ($event['category'] == get_service_define('WEB_PPA')) {
                        $serviceClass = $event->getSubject();
                        myadmin_log(self::$module, 'info', 'PleskAutomation Deactivation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
            Severity: Minor
            Found in src/Plugin.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 getReactivate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getReactivate(GenericEvent $event)
                {
                    if ($event['category'] == get_service_define('WEB_PPA')) {
                        $serviceClass = $event->getSubject();
                        $serverdata = get_service_master($serviceClass->getServer(), self::$module);
            Severity: Minor
            Found in src/Plugin.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 true;
            Severity: Major
            Found in src/Plugin.php - About 30 mins to fix

              TODO found
              Open

                               * @TODO Double Check The Server To Ensure The Site Isnt There And Our Information Is Correct, If Not Then Update It With Correect Info And Use That To Terminate Instead.
              Severity: Minor
              Found in src/Plugin.php by fixme

              There are no issues that match your filters.

              Category
              Status