Missing class import via use statement (line '33', column '14'). Open
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 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\Module' in method 'slaPolicyTemplate'. Open
$viewer->assign('TARGET_MODULE_ID', \App\Module::getModuleId($request->getByType('targetModule', \App\Purifier::ALNUM)));
- 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\ServiceContracts' in method 'slaPolicyTemplate'. Open
$sla = \App\Utils\ServiceContracts::getSlaPolicyForServiceContracts($request->getInteger('record'));
- 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 'Vtiger_Record_Model' in method 'checkPermission'. Open
$this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $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\Utils\ServiceContracts' in method 'slaPolicyCustom'. Open
$viewer->assign('ALL_BUSINESS_HOURS', \App\Utils\ServiceContracts::getAllBusinessHours());
- 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 (!$this->record->isViewable() || !$this->record->isPermitted('ServiceContractsSla') || !App\Privilege::isPermitted($request->getByType('targetModule', \App\Purifier::ALNUM))) {
- 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('SELECTED_TEMPLATE', $slaId);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TARGET_MODULE_ID', \App\Module::getModuleId($request->getByType('targetModule', \App\Purifier::ALNUM)));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RECORD', $this->record);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SLA_POLICY_ROWS', [$index => $defaultEmptyData]);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ALL_BUSINESS_HOURS', \App\Utils\ServiceContracts::getAllBusinessHours());
- Exclude checks
Avoid excessively long class names like ServiceContracts_PolicyTemplatesAjax_View. Keep class name length under 40. Open
class ServiceContracts_PolicyTemplatesAjax_View extends Vtiger_Index_View
{
use \App\Controller\ExposeMethod;
/** @var Vtiger_Record_Model Record model instance. */
- Read upRead up
- Exclude checks
LongClassName
Since: 2.9
Detects when classes or interfaces are declared with excessively long names.
Example
class ATooLongClassNameThatHintsAtADesignProblem {
}
interface ATooLongInterfaceNameThatHintsAtADesignProblem {
}
Source https://phpmd.org/rules/naming.html#longclassname
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class ServiceContracts_PolicyTemplatesAjax_View extends Vtiger_Index_View
- Exclude checks
The class ServiceContracts_PolicyTemplatesAjax_View is not named in CamelCase. Open
class ServiceContracts_PolicyTemplatesAjax_View extends Vtiger_Index_View
{
use \App\Controller\ExposeMethod;
/** @var Vtiger_Record_Model Record model instance. */
- 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
* Construct.
- 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
Line exceeds 120 characters; contains 129 characters Open
$viewer->assign('TARGET_MODULE_ID', \App\Module::getModuleId($request->getByType('targetModule', \App\Purifier::ALNUM)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'idle_time' => '1:d',
- 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
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 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
*/
- 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->exposeMethod('slaPolicyTemplate');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function slaPolicyTemplate(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$index = $request->getInteger('index', time());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'policy_type' => 2,
- 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
use \App\Controller\ExposeMethod;
- Exclude checks
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
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $record;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$slaId = $sla[0]['sla_policy_id'] ?? 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'business_hours' => '',
- 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
/** @var Vtiger_Record_Model Record model instance. */
- 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
/** {@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
$viewer->assign('ALL_BUSINESS_HOURS', \App\Utils\ServiceContracts::getAllBusinessHours());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SLA_POLICY_ROWS', [$index => $defaultEmptyData]);
- 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
return $viewer->view('SlaPolicyTemplate.tpl', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('slaPolicyCustom');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultEmptyData = [
- 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
'resolve_time' => '1:d',
- 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->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
- 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
return $viewer->view('CustomConditions.tpl', $moduleName);
- 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
public function slaPolicyCustom(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
$sla = \App\Utils\ServiceContracts::getSlaPolicyForServiceContracts($request->getInteger('record'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TARGET_MODULE_ID', \App\Module::getModuleId($request->getByType('targetModule', \App\Purifier::ALNUM)));
- 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
$moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => 0,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'conditions' => '[]',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->record->isViewable() || !$this->record->isPermitted('ServiceContractsSla') || !App\Privilege::isPermitted($request->getByType('targetModule', \App\Purifier::ALNUM))) {
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
if (!$this->record->isViewable() || !$this->record->isPermitted('ServiceContractsSla') || !App\Privilege::isPermitted($request->getByType('targetModule', \App\Purifier::ALNUM))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SELECTED_TEMPLATE', $slaId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'reaction_time' => '1:d',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RECORD', $this->record);
- Exclude checks
Class name "ServiceContracts_PolicyTemplatesAjax_View" is not in camel caps format Open
class ServiceContracts_PolicyTemplatesAjax_View extends Vtiger_Index_View
- Exclude checks