Missing class import via use statement (line '34', column '14'). Open
throw new \App\Exceptions\NoPermitted('LBL_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 '\App\RecordCollector' in method 'preProcessAjax'. Open
$this->recordCollector = \App\RecordCollector::getInstance($request->getByType('collectorType', 'ClassName'), $request->getModule());
- 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\Privilege' in method 'checkPermission'. Open
if (!\App\Privilege::isPermitted($request->getModule(), 'EditView')) {
- 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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$viewer->view('Modals/RecordCollector.tpl', $request->getModule());
}
- 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 '\App\Language' in method 'preProcessAjax'. Open
$this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');
- 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
Reference to undeclared class \App\Controller\Modal
Open
parent::preProcessAjax($request);
- Exclude checks
Reference to instance property label
from undeclared class \App\RecordCollectors\Base
Open
$this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');
- Exclude checks
Reference to instance property icon
from undeclared class \App\RecordCollectors\Base
Open
$this->modalIcon = $this->recordCollector->icon;
- Exclude checks
Call to method search
from undeclared class \App\RecordCollectors\Base
(Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base) Open
$viewer->assign('SEARCH_DATA', $this->recordCollector->search());
- Exclude checks
Call to undeclared method \Vtiger_RecordCollector_View::getViewer
Open
$viewer = $this->getViewer($request);
- Exclude checks
Property \Vtiger_RecordCollector_View->recordCollector
has undeclared type \App\RecordCollectors\Base
(Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base) Open
private $recordCollector;
- Exclude checks
Reference to undeclared property \Vtiger_RecordCollector_View->modalIcon
Open
$this->modalIcon = $this->recordCollector->icon;
- Exclude checks
Class extends undeclared class \App\Controller\Modal
Open
class Vtiger_RecordCollector_View extends \App\Controller\Modal
- Exclude checks
Reference to undeclared property \Vtiger_RecordCollector_View->pageTitle
Open
$this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');
- Exclude checks
Call to method setRequest
from undeclared class \App\RecordCollectors\Base
(Did you mean class \App\Base or class \App\Cache\Base or class \App\Cli\Base or class \App\Controller\Base or class \App\Controller\View\Base or class \App\Db\Importers\Base or class \Tests\Base) Open
$this->recordCollector->setRequest($request);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_RecordCollector_View extends \App\Controller\Modal
- Exclude checks
The class Vtiger_RecordCollector_View is not named in CamelCase. Open
class Vtiger_RecordCollector_View extends \App\Controller\Modal
{
/** {@inheritdoc} */
public $showFooter = 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
public $modalSize = 'c-modal-xxl';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->modalIcon = $this->recordCollector->icon;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RECORD_ID', $request->getInteger('record'));
- 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
$this->recordCollector = \App\RecordCollector::getInstance($request->getByType('collectorType', 'ClassName'), $request->getModule());
- 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 ('search' === $request->getMode()) {
- 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
$this->pageTitle = \App\Language::translate($this->recordCollector->label, 'Other.RecordCollector');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$request->getMode()) {
- 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('SEARCH_DATA', $this->recordCollector->search());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
$this->recordCollector = \App\RecordCollector::getInstance($request->getByType('collectorType', 'ClassName'), $request->getModule());
- 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
/** {@inheritdoc} */
- 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
$viewer->view('Modals/RecordCollector.tpl', $request->getModule());
- 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->assign('RECORD_COLLECTOR', $this->recordCollector);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->recordCollector->setRequest($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $showFooter = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $modalId = 'record-collector-modal';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $recordCollector;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::preProcessAjax($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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var \App\RecordCollectors\Base Record collector instance. */
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function preProcessAjax(App\Request $request)
- 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('COLLECTOR_NAME', $request->getByType('collectorType', 'ClassName'));
- 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 process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Privilege::isPermitted($request->getModule(), 'EditView')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('Modals/RecordCollectorSearch.tpl', $request->getModule());
- Exclude checks
Class name "Vtiger_RecordCollector_View" is not in camel caps format Open
class Vtiger_RecordCollector_View extends \App\Controller\Modal
- Exclude checks