Avoid using static access to class 'Settings_Menu_Record_Model' in method 'process'. Open
$viewer->assign('ICONS_LABEL', Settings_Menu_Record_Model::getIcons());
- 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
Avoid using static access to class 'Settings_Menu_Record_Model' in method 'process'. Open
$viewer->assign('RECORD', Settings_Menu_Record_Model::getInstanceById($id));
- 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
Avoid using static access to class 'Settings_Menu_Module_Model' in method 'process'. Open
$viewer->assign('MODULE_MODEL', Settings_Menu_Module_Model::getInstance());
- 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 \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_MODEL', Settings_Menu_Module_Model::getInstance());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ICONS_LABEL', Settings_Menu_Record_Model::getIcons());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ID', $id);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RECORD', Settings_Menu_Record_Model::getInstanceById($id));
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Menu_EditMenu_View extends Settings_Vtiger_IndexAjax_View
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $request->getInteger('id');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class Settings_Menu_EditMenu_View is not named in CamelCase. Open
class Settings_Menu_EditMenu_View extends Settings_Vtiger_IndexAjax_View
{
public function process(App\Request $request)
{
$qualifiedModuleName = $request->getModule(false);
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('MODULE_MODEL', Settings_Menu_Module_Model::getInstance());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ICONS_LABEL', Settings_Menu_Record_Model::getIcons());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $request->getInteger('id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qualifiedModuleName = $request->getModule(false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ID', $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RECORD', Settings_Menu_Record_Model::getInstanceById($id));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('EditMenu.tpl', $qualifiedModuleName);
- 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
{
- Exclude checks
Class name "Settings_Menu_EditMenu_View" is not in camel caps format Open
class Settings_Menu_EditMenu_View extends Settings_Vtiger_IndexAjax_View
- Exclude checks