Showing 102 of 102 total issues
Method createCustomer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createCustomer($username, $password, $data)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
Function deleteSite
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function deleteSite($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 updateSite
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function updateSite($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 deleteSite
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteSite($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Method getErrorCodes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getErrorCodes()
{
return [
1001 => 'Authentication failed - wrong password.',
1002 => 'User account already exists.',
Method deleteClient
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteClient($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Method listClients
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listClients()
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Method getWebspaces
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getWebspaces($hosting = true, $limits = true, $stat = true, $prefs = true)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Method getClient
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getClient($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Avoid using undefined variables such as '$mapping' which will lead to PHP notices. Open
if (isset($mapping[$field])) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$mapping' which will lead to PHP notices. Open
if (isset($mapping[$field])) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$mapping' which will lead to PHP notices. Open
$realField = $mapping[$field];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$mapping' which will lead to PHP notices. Open
$realField = $mapping[$field];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Method getTerminate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getTerminate(GenericEvent $event)
{
if ($event['category'] == get_service_define('WEB_PLESK')) {
$event->stopPropagation();
$serviceClass = $event->getSubject();
Method getServerInfo
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getServerInfo()
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Method createMailAccount
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createMailAccount($params)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
Method createSession
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSession($user)
{
$xmldoc = new \DomDocument('1.0', 'UTF-8');
$xmldoc->formatOutput = true;
$packet = $xmldoc->createElement('packet');
Function listClients
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function listClients()
{
$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 fixResult
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function fixResult($result)
{
if (is_array($result)) {
$tempResult = $result;
foreach ($tempResult as $key => $value) {
- 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 deleteSubscription
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function deleteSubscription($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"