Missing class import via use statement (line '35', column '14'). Open
throw new \App\Exceptions\NoPermitted('ERR_PERMISSION_DENIED', 406);
- 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 using static access to class 'Users_Privileges_Model' in method 'checkPermission'. Open
$currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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\Condition' in method 'checkPermission'. Open
$this->advancedConditions = \App\Condition::validAdvancedConditions($request->getArray('advancedConditions'));
- 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
Argument 1 (mixed)
is string
but \Users_Privileges_Model::hasModulePermission()
takes int
defined at /code/modules/Users/models/Privileges.php:101
Open
if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule()) || !$currentUserPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CustomViewAdvCond')) {
- Exclude checks
Call to undeclared method \Vtiger_CustomViewAdvCondModal_View::getViewer
Open
$viewer = $this->getViewer($request);
- Exclude checks
Class extends undeclared class \App\Controller\Modal
Open
class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal
- Exclude checks
Avoid excessively long variable names like $currentUserPrivilegesModel. Keep variable name length under 20. Open
$currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal
- Exclude checks
The class Vtiger_CustomViewAdvCondModal_View is not named in CamelCase. Open
class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal
{
/** {@inheritdoc} */
protected $pageTitle = 'LBL_CUSTOM_VIEW_ADV_COND';
- 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 $modalIcon = 'yfi-advenced-custom-view-conditions';
- 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
/** @var array Advanced conditions */
- 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
public function process(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Line exceeds 120 characters; contains 190 characters Open
if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule()) || !$currentUserPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CustomViewAdvCond')) {
- 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
if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule()) || !$currentUserPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CustomViewAdvCond')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $advancedConditions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RELATIONS', Vtiger_Module_Model::getInstance($moduleName)->getRelations());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $successBtn = 'LBL_SAVE';
- 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->advancedConditions = \App\Condition::validAdvancedConditions($request->getArray('advancedConditions'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ADVANCED_CONDITIONS', $this->advancedConditions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $pageTitle = 'LBL_CUSTOM_VIEW_ADV_COND';
- 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
throw new \App\Exceptions\NoPermitted('ERR_PERMISSION_DENIED', 406);
- 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->view('CustomView/AdvCondModal.tpl', $moduleName);
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkPermission(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Class name "Vtiger_CustomViewAdvCondModal_View" is not in camel caps format Open
class Vtiger_CustomViewAdvCondModal_View extends \App\Controller\Modal
- Exclude checks