Showing 12 of 12 total issues
Function doEnable
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function doEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
{
$serviceInfo = $serviceOrder->getServiceInfo();
$settings = get_module_settings(self::$module);
$db = get_module_db(self::$module);
- 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 doEnable
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function doEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
{
$serviceInfo = $serviceOrder->getServiceInfo();
$settings = get_module_settings(self::$module);
$db = get_module_db(self::$module);
Function vps_ips_check_current
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function vps_ips_check_current($addon)
{
$addon->db->query("select * from invoices left join repeat_invoices on repeat_invoices_custid=invoices_custid and repeat_invoices_service=invoices_service and repeat_invoices_id=invoices_extra where invoices_custid={$addon->serviceInfo[$addon->settings['PREFIX'].'_custid']} and invoices_type=1 and invoices_service={$addon->serviceInfo[$addon->settings['PREFIX'].'_id']} and invoices_description like '%Additional IP%' group by invoices_extra", __LINE__, __FILE__);
//$addon->db->query("select repeat_invoices_id, repeat_invoices_description from repeat_invoices where repeat_invoices_description like 'Additional IP%for {$addon->settings['TBLNAME']} {$addon->serviceInfo[$addon->settings['PREFIX'].'_id']}'", __LINE__, __FILE__);
$ips = $addon->db->num_rows();
- 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 vps_ips_check_current
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function vps_ips_check_current($addon)
{
$addon->db->query("select * from invoices left join repeat_invoices on repeat_invoices_custid=invoices_custid and repeat_invoices_service=invoices_service and repeat_invoices_id=invoices_extra where invoices_custid={$addon->serviceInfo[$addon->settings['PREFIX'].'_custid']} and invoices_type=1 and invoices_service={$addon->serviceInfo[$addon->settings['PREFIX'].'_id']} and invoices_description like '%Additional IP%' group by invoices_extra", __LINE__, __FILE__);
//$addon->db->query("select repeat_invoices_id, repeat_invoices_description from repeat_invoices where repeat_invoices_description like 'Additional IP%for {$addon->settings['TBLNAME']} {$addon->serviceInfo[$addon->settings['PREFIX'].'_id']}'", __LINE__, __FILE__);
$ips = $addon->db->num_rows();
Missing class import via use statement (line '61', column '22'). Open
$addon = new \AddonHandler();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '109', column '22'). Open
(new \MyAdmin\Mail())->adminMail($subject, $settings['TBLNAME']." {$serviceInfo[$settings['PREFIX'].'_id']} Has Pending IPS<br>\n".$subject, false, 'admin/vps_no_ips.tpl');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '143', column '14'). Open
(new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/vps_ip_canceled.tpl');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '100', column '41'). Open
$repeatInvoiceObj = new \MyAdmin\Orm\Repeat_Invoice();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '60', column '18'). Open
$addon = new AddServiceAddon();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '92', column '35'). Open
$invoiceObj = new \MyAdmin\Orm\Invoice();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The variable $link_disable is not named in camelCase. Open
function vps_ips_check_current($addon)
{
$addon->db->query("select * from invoices left join repeat_invoices on repeat_invoices_custid=invoices_custid and repeat_invoices_service=invoices_service and repeat_invoices_id=invoices_extra where invoices_custid={$addon->serviceInfo[$addon->settings['PREFIX'].'_custid']} and invoices_type=1 and invoices_service={$addon->serviceInfo[$addon->settings['PREFIX'].'_id']} and invoices_description like '%Additional IP%' group by invoices_extra", __LINE__, __FILE__);
//$addon->db->query("select repeat_invoices_id, repeat_invoices_description from repeat_invoices where repeat_invoices_description like 'Additional IP%for {$addon->settings['TBLNAME']} {$addon->serviceInfo[$addon->settings['PREFIX'].'_id']}'", __LINE__, __FILE__);
$ips = $addon->db->num_rows();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $link_disable is not named in camelCase. Open
function vps_ips_check_current($addon)
{
$addon->db->query("select * from invoices left join repeat_invoices on repeat_invoices_custid=invoices_custid and repeat_invoices_service=invoices_service and repeat_invoices_id=invoices_extra where invoices_custid={$addon->serviceInfo[$addon->settings['PREFIX'].'_custid']} and invoices_type=1 and invoices_service={$addon->serviceInfo[$addon->settings['PREFIX'].'_id']} and invoices_description like '%Additional IP%' group by invoices_extra", __LINE__, __FILE__);
//$addon->db->query("select repeat_invoices_id, repeat_invoices_description from repeat_invoices where repeat_invoices_description like 'Additional IP%for {$addon->settings['TBLNAME']} {$addon->serviceInfo[$addon->settings['PREFIX'].'_id']}'", __LINE__, __FILE__);
$ips = $addon->db->num_rows();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}