Showing 83 of 83 total issues
Method loadProcessing
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function loadProcessing(GenericEvent $event)
{
/**
* @var \ServiceHandler $service
*/
Method api_buy_vps_admin
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function api_buy_vps_admin($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass, $server = 0)
{
if ($GLOBALS['tf']->ima != 'admin') {
$server = 0;
} else {
Method doSliceEnable
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
{
$deferUpgradeViaTicket = true;
$serviceInfo = $serviceOrder->getServiceInfo();
$serviceTypes = run_event('get_service_types', false, self::$module);
Method api_buy_vps
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function api_buy_vps($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass)
{
$custid = get_custid($GLOBALS['tf']->session->account_id, 'vps');
function_requirements('validate_buy_vps');
$validation = validate_buy_vps($custid, $os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass);
Avoid excessively long variable names like $deferUpgradeViaTicket. Keep variable name length under 20. Open
$deferUpgradeViaTicket = true;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Method api_buy_vps_admin
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
function api_buy_vps_admin($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass, $server = 0)
Method api_buy_vps
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
function api_buy_vps($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass)
Method api_validate_buy_vps
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
function api_validate_buy_vps($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass)
Function doSliceEnable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function doSliceEnable(\ServiceHandler $serviceOrder, $repeatInvoiceId, $regexMatch = false)
{
$deferUpgradeViaTicket = true;
$serviceInfo = $serviceOrder->getServiceInfo();
$serviceTypes = run_event('get_service_types', false, 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
Missing class import via use statement (line '125', 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 '158', column '33'). 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 '228', column '22'). Open
(new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/vps_reactivated.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 '224', column '31'). Open
$smarty = new \TFSmarty();
- 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 '167', column '27'). 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
Avoid unused local variables such as '$monthly_service_cost'. Open
$monthly_service_cost = $validation['monthly_service_cost'];
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The function api_validate_buy_vps has 10 parameters. Consider reducing the number of parameters to less than 10. Open
function api_validate_buy_vps($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass)
{
//if ($GLOBALS['tf']->ima == 'admin')
$custid = get_custid($GLOBALS['tf']->session->account_id, 'vps');
function_requirements('validate_buy_vps');
- Exclude checks
Avoid unused local variables such as '$repeat_slice_cost'. Open
$repeat_slice_cost = $validation['repeat_slice_cost'];
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$class'. Open
$class = '\\MyAdmin\\Orm\\'.get_orm_class_from_table($settings['TABLE']);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The function api_buy_vps has 10 parameters. Consider reducing the number of parameters to less than 10. Open
function api_buy_vps($os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass)
{
$custid = get_custid($GLOBALS['tf']->session->account_id, 'vps');
function_requirements('validate_buy_vps');
$validation = validate_buy_vps($custid, $os, $slices, $platform, $controlpanel, $period, $location, $version, $hostname, $coupon, $rootpass);
- Exclude checks
Avoid unused local variables such as '$monthly_service_cost'. Open
$monthly_service_cost = $validation['monthly_service_cost'];
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}