Showing 108 of 108 total issues
File SoftaculousNOC.php
has 627 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Softaculous Related Functionality
* @author Joe Huss <detain@interserver.net>
* @copyright 2020
SoftaculousNOC
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
class SoftaculousNOC
{
private $nocname = 'username';
private $nocpass = 'password';
public $softaculous = 'https://www.softaculous.com/noc';
Function array2json
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function array2json($arr)
{
if (function_exists('json_encode')) {
return json_encode($arr);
} //Lastest versions of PHP already has this functionality.
- 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 sitemush_refund_and_cancel
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function sitemush_refund_and_cancel($key = '', $ip = '', $force = 0)
{
if (!empty($ip)) {
// Search for a license
$lic = $this->sitemush_licenses('', $ip);
- 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 refund_and_cancel
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function refund_and_cancel($key = '', $ip = '', $force = 0)
{
if (!empty($ip)) {
// Search for a license
$lic = $this->licenses('', $ip);
- 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 webuzo_refund_and_cancel
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function webuzo_refund_and_cancel($key = '', $ip = '', $force = 0)
{
if (!empty($ip)) {
// Search for a license
$lic = $this->webuzo_licenses('', $ip);
- 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 virt_refund_and_cancel
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function virt_refund_and_cancel($key = '', $ip = '', $force = 0)
{
if (!empty($ip)) {
// Search for a license
$lic = $this->virt_licenses('', $ip);
- 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 array2json
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function array2json($arr)
{
if (function_exists('json_encode')) {
return json_encode($arr);
} //Lastest versions of PHP already has this functionality.
Function webuzo_list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function webuzo_list()
{
if ($GLOBALS['tf']->ima == 'admin') {
$table = new \TFTable();
$table->set_title('webuzo License List');
- 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 softaculous_list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function softaculous_list()
{
if ($GLOBALS['tf']->ima == 'admin') {
$table = new \TFTable();
$table->set_title('Softaculous License List');
- 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 toArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function toArray($xml)
{
if (is_string($xml)) {
$xml = new SimpleXMLElement($xml);
}
- 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 toArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function toArray($xml)
{
if (is_string($xml)) {
$xml = new \SimpleXMLElement($xml);
}
- 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 toXML
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function toXML($data, $rootNodeName = 'ResultSet', $xml=null)
{
// turn off compatibility mode as simple xml throws a wobbly if you don't.
if (ini_get('zend.ze1_compatibility_mode') == 1) {
- 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 activate_webuzo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function activate_webuzo($ipAddress, $field = '', $email = '')
{
myadmin_log('softaculous', 'info', "activating webuzo({$ipAddress}, {$field}, {$email})", __LINE__, __FILE__);
try {
$noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(WEBUZO_USERNAME, WEBUZO_PASSWORD);
- 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 activate_webuzo
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activate_webuzo($ipAddress, $field = '', $email = '')
{
myadmin_log('softaculous', 'info', "activating webuzo({$ipAddress}, {$field}, {$email})", __LINE__, __FILE__);
try {
$noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(WEBUZO_USERNAME, WEBUZO_PASSWORD);
Avoid using short method names like SoftaculousNOC::r(). The configured minimum method name length is 3. Open
public function r($r)
{
if (empty($r)) {
$r = $this->error;
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Function toXML
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function toXML($data, $rootNodeName = 'ResultSet', $xml = null)
{
if (null === $xml) { //$xml = simplexml_load_string( "" );
$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
}
- 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 req
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function req()
{
$url = $this->softaculous.'?';
foreach ($this->params as $k => $v) {
Avoid using undefined variables such as '$ipAddress' which will lead to PHP notices. Open
$licenses = $noc->licenses('', $ipAddress);
- 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 '$return' which will lead to PHP notices. Open
$return['status'] = 'error';
- 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;
}
}