detain/myadmin-vestacp-webhosting

View on GitHub

Showing 7 of 10 total issues

File VestaCP.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Detain\MyAdminVestaCP;

/**
Severity: Minor
Found in src/VestaCP.php - About 2 hrs to fix

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

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

      Method createAccount has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createAccount($username, $password, $email, $name, $package = 'default')
          {
              $firstName = trim(mb_substr($name, 0, mb_strpos(' ', $name)));
              $lastName = trim(mb_substr($name, mb_strpos(' ', $name) + 1));
              $vstReturncode = 'yes';
      Severity: Minor
      Found in src/VestaCP.php - About 1 hr to fix

        Method addDatabase has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addDatabase($username, $dbName, $dbUser, $dbPass)
            {
                $vstReturncode = 'yes';
                $vstCommand = 'v-add-database';
        
        
        Severity: Minor
        Found in src/VestaCP.php - About 1 hr to fix

          Method createAccount has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function createAccount($username, $password, $email, $name, $package = 'default')
          Severity: Minor
          Found in src/VestaCP.php - About 35 mins to fix

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

                public static function getTerminate(GenericEvent $event)
                {
                    if ($event['category'] == get_service_define('WEB_VESTA')) {
                        $serviceClass = $event->getSubject();
                        myadmin_log(self::$module, 'info', 'VestaCP Termination', __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

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

                public static function getActivate(GenericEvent $event)
                {
                    if ($event['category'] == get_service_define('WEB_VESTA')) {
                        $serviceClass = $event->getSubject();
                        myadmin_log(self::$module, 'info', 'VestaCP 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

            Severity
            Category
            Status
            Source
            Language