Showing 7 of 10 total issues
File VestaCP.php
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace Detain\MyAdminVestaCP;
/**
Method getActivate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
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());
Method createAccount
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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';
Method addDatabase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addDatabase($username, $dbName, $dbUser, $dbPass)
{
$vstReturncode = 'yes';
$vstCommand = 'v-add-database';
Method createAccount
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function createAccount($username, $password, $email, $name, $package = 'default')
Function getTerminate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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());
- Read upRead up
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
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());
- Read upRead up
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"