modules/OSSEmployees/models/DetailView.php
Avoid using static access to class 'Vtiger_Link_Model' in method 'getDetailViewLinks'. Open
Open
$linkModelLists['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_BASIC',
'linkhint' => 'LBL_SHOW_EMPLOYEES_HIERARCHY',
'linkurl' => 'javascript:OSSEmployees_Detail_Js.triggerEmployeeHierarchy("' . $linkURL . '");',
'linkicon' => 'yfi-hierarchy',
- 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 \Vtiger_DetailView_Model
Open
Open
$linkModelLists = parent::getDetailViewLinks($linkParams);
- Exclude checks
Class extends undeclared class \Vtiger_DetailView_Model
Open
Open
class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks
Call to undeclared method \OSSEmployees_DetailView_Model::getRecord
Open
Open
$linkURL = 'index.php?module=OSSEmployees&view=EmployeeHierarchy&record=' . $this->getRecord()->getId();
- Exclude checks
Call to undeclared method \OSSEmployees_DetailView_Model::getRecord
Open
Open
if (!$this->getRecord()->isReadOnly()) {
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks
The class OSSEmployees_DetailView_Model is not named in CamelCase. Open
Open
class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
{
/** {@inheritdoc} */
public function getDetailViewLinks(array $linkParams): array
{
- 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
Open
if (!$this->getRecord()->isReadOnly()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'linkhint' => 'LBL_SHOW_EMPLOYEES_HIERARCHY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$linkURL = 'index.php?module=OSSEmployees&view=EmployeeHierarchy&record=' . $this->getRecord()->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'linktype' => 'DETAIL_VIEW_BASIC',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'linkurl' => 'javascript:OSSEmployees_Detail_Js.triggerEmployeeHierarchy("' . $linkURL . '");',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getDetailViewLinks(array $linkParams): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$linkModelLists['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'linkicon' => 'yfi-hierarchy',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$linkModelLists = parent::getDetailViewLinks($linkParams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'linkclass' => 'btn-outline-dark btn-sm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $linkModelLists;
- Exclude checks
Class name "OSSEmployees_DetailView_Model" is not in camel caps format Open
Open
class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks