Showing 41 of 102 total issues
File Plesk.php
has 1971 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Detain\MyAdminPlesk;
use Detain\MyAdminPlesk\ApiRequestException;
Function getActivate
has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring. Open
public static function getActivate(GenericEvent $event)
{
if ($event['category'] == get_service_define('WEB_PLESK')) {
$serviceClass = $event->getSubject();
myadmin_log(self::$module, 'info', 'Plesk 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"
Further reading
Plesk
has 71 functions (exceeds 20 allowed). Consider refactoring. Open
class Plesk
{
public $curl;
private $host;
private $login;
Method getActivate
has 216 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getActivate(GenericEvent $event)
{
if ($event['category'] == get_service_define('WEB_PLESK')) {
$serviceClass = $event->getSubject();
myadmin_log(self::$module, 'info', 'Plesk Activation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
File Plugin.php
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Detain\MyAdminPlesk;
use Detain\MyAdminPlesk\ApiRequestException;
Method createSubscription
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSubscription($params)
{
$required = [
'name',
'ip_address'
Method createSite
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSite($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Function createSite
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function createSite($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
- 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 createSubscription
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function createSubscription($params)
{
$required = [
'name',
'ip_address'
- 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 getSites
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function getSites($params = false)
{
if ($params === false) {
$params = [];
}
- 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
File test.php
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Plesk Test
*
* This file attempts the following operations on a real Plesk server (intended to be run by an admin account)
Function listSubscriptions
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function listSubscriptions($params = false)
{
if ($params === false) {
$params = [];
}
- 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
Method getSites
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSites($params = false)
{
if ($params === false) {
$params = [];
}
Method updateClient
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateClient($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Function updateClient
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function updateClient($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
- 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
Method listSubscriptions
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listSubscriptions($params = false)
{
if ($params === false) {
$params = [];
}
Method createClient
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createClient($data)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Method updateSite
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateSite($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Consider simplifying this complex logical expression. Open
if (is_numeric($key) && is_array($value) && count($value) == 2 && isset($value['name']) && isset($value['value'])) {
unset($result[$key]);
$result[$value['name']] = $value['value'];
} elseif (is_numeric($key) && is_array($value) && count($value) == 2 && isset($value['name']) && isset($value['version'])) {
unset($result[$key]);
Method deleteSubscription
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteSubscription($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');