Method moduleHandler
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function moduleHandler($moduleName, $eventType)
{
require_once 'include/utils/CommonUtils.php';
require_once 'include/fields/DateTimeField.php';
require_once 'include/fields/DateTimeRange.php';
Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'moduleHandler'. Open
Settings_Vtiger_Module_Model::addSettingsField('LBL_INTEGRATION', [
'name' => $displayLabel,
'iconpath' => '',
'description' => 'LBL_API_ADDRESS_DESCRIPTION',
'linkto' => 'index.php?module=ApiAddress&parent=Settings&view=Configuration',
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method moduleHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
Settings_Vtiger_Module_Model::deleteSettingsField('LBL_INTEGRATION', $displayLabel);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'moduleHandler'. Open
Settings_Vtiger_Module_Model::deleteSettingsField('LBL_INTEGRATION', $displayLabel);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->insert('s_yf_address_finder_config', ['nominatim' => 0, 'key' => 0, 'source' => 'https://api.opencagedata.com/geocode/v1/', 'min_length' => 3])->execute();
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param string Module name':
after string,
did not see an element name (will guess based on comment order) Open
* @param string Module name
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param string Event Type':
after string,
did not see an element name (will guess based on comment order) Open
* @param string Event Type
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class ApiAddress
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $eventType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Settings_Vtiger_Module_Model::addSettingsField('LBL_INTEGRATION', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function moduleHandler($moduleName, $eventType)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/fields/CurrencyField.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'iconpath' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkto' => 'index.php?module=ApiAddress&parent=Settings&view=Configuration',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invoked when special actions are performed on the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/CRMEntity.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
include_once 'modules/Vtiger/CRMEntity.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/Webservices/Utils.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Add Assets Module to Customer Portal
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/PickList/DependentPickListUtils.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$registerLink = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->insert('s_yf_address_finder_config', ['nominatim' => 0, 'key' => 0, 'source' => 'https://api.opencagedata.com/geocode/v1/', 'min_length' => 3])->execute();
- Exclude checks
Line exceeds 120 characters; contains 208 characters Open
\App\Db::getInstance()->createCommand()->insert('s_yf_address_finder_config', ['nominatim' => 0, 'key' => 0, 'source' => 'https://api.opencagedata.com/geocode/v1/', 'min_length' => 3])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$displayLabel = 'LBL_API_ADDRESS';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/runtime/Cache.php';
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => 'LBL_API_ADDRESS_DESCRIPTION',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Settings_Vtiger_Module_Model::deleteSettingsField('LBL_INTEGRATION', $displayLabel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string Event Type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/fields/DateTimeRange.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/Vtiger/helpers/Util.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/Users/Users.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $displayLabel,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/fields/DateTimeField.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$registerLink = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($registerLink) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string Module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'include/utils/CommonUtils.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('module.postinstall' === $eventType) {
- Exclude checks