Avoid using static access to class '\App\Utils' in method 'permissions'. Open
$viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);
- 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_AdminAccess_Module_Model' in method 'historyAdminsVisitPurpose'. Open
$viewer->assign('CONFIG_FIELDS', Settings_AdminAccess_Module_Model::getFields($qualifiedModuleName));
- 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 '\App\Utils' in method 'historyAdminsVisitPurpose'. Open
$viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);
- 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_Vtiger_Module_Model' in method 'historyAdminsVisitPurpose'. Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
- 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_Vtiger_Module_Model' in method 'permissions'. Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
- 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 'App\Config' in method 'historyAdminsVisitPurpose'. Open
$viewer->assign('CONFIG', App\Config::security());
- 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_Vtiger_Module_Model' in method 'process'. Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
- 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 assigning values to variables in if clauses and the like (line '29', column '7'). Open
public function process(App\Request $request)
{
if ($mode = $request->getMode()) {
$this->invokeExposedMethod($mode, $request);
return;
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Define a constant instead of duplicating this literal "MODULE_MODEL" 3 times. Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TAB', $request->has('tab') ? $request->getByType('tab') : 'permissions');
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getLinks
Open
$viewer->assign('LINKS', $moduleModel->getLinks());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('LINKS', $moduleModel->getLinks());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('STRUCTURE', $moduleModel->getStructure('visitPurpose'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('CONFIG_FIELDS', Settings_AdminAccess_Module_Model::getFields($qualifiedModuleName));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getStructure
Open
$viewer->assign('STRUCTURE', $moduleModel->getStructure('visitPurpose'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('CONFIG', App\Config::security());
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_AdminAccess_Index_View extends Settings_Vtiger_Index_View
- Exclude checks
The class Settings_AdminAccess_Index_View is not named in CamelCase. Open
class Settings_AdminAccess_Index_View extends Settings_Vtiger_Index_View
{
/** {@inheritdoc} */
public function __construct()
{
- 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
public function __construct()
- 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
$viewer = $this->getViewer($request);
- 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
*
- 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
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($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
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('LINKS', $moduleModel->getLinks());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- 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
$this->invokeExposedMethod($mode, $request);
- 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
* Gets permissions tab view.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- 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
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('CONFIG_FIELDS', Settings_AdminAccess_Module_Model::getFields($qualifiedModuleName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('CONFIG', App\Config::security());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TAB', $request->has('tab') ? $request->getByType('tab') : 'permissions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('permissions');
- 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
return;
- 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
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('historyAdminsVisitPurpose');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($mode = $request->getMode()) {
- 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
$moduleModel = Settings_Vtiger_Module_Model::getInstance($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
$viewer->assign('STRUCTURE', $moduleModel->getStructure('visitPurpose'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('Index.tpl', $qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function permissions(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- 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
Spaces must be used to indent lines; tabs are not allowed Open
public function historyAdminsVisitPurpose(App\Request $request)
- 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
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
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets history admins visit purpose tab view.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view(\App\Utils::mbUcfirst($request->getMode()) . '.tpl', $qualifiedModuleName);
- Exclude checks
Class name "Settings_AdminAccess_Index_View" is not in camel caps format Open
class Settings_AdminAccess_Index_View extends Settings_Vtiger_Index_View
- Exclude checks