Method getDetailViewLinks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDetailViewLinks(array $linkParams): array
{
if ($this->getRecord()->isReadOnly() || \App\RequestUtil::getBrowserInfo()->ie) {
return parent::getDetailViewLinks($linkParams);
}
Avoid using static access to class '\App\Language' in method 'getDetailViewLinks'. Open
'title' => \App\Language::translate('LBL_GO_TO_PREVIEW', $moduleName),
- 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\Language' in method 'getDetailViewLinks'. Open
'linkhint' => \App\Language::translate('LBL_GO_TO_PREVIEW', $moduleName),
- 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_Link_Model' in method 'getDetailViewLinks'. Open
$relatedLinks[] = Vtiger_Link_Model::getInstanceFromValues($relatedLinkEntry);
- 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
return parent::getDetailViewLinks($linkParams);
- Exclude checks
Call to undeclared method \KnowledgeBase_DetailView_Model::getRecord
Open
if ($this->getRecord()->isReadOnly() || \App\RequestUtil::getBrowserInfo()->ie) {
- Exclude checks
Call to undeclared method \KnowledgeBase_DetailView_Model::getRecord
Open
$recordModel = $this->getRecord();
- Exclude checks
Reference to undeclared class \Vtiger_DetailView_Model
Open
$linkModelList = parent::getDetailViewLinks($linkParams);
- Exclude checks
Class extends undeclared class \Vtiger_DetailView_Model
Open
class KnowledgeBase_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class KnowledgeBase_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks
The class KnowledgeBase_DetailView_Model is not named in CamelCase. Open
class KnowledgeBase_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
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relatedLinks as $relatedLink) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = $this->getRecord();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedLinkEntries = [
- 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 $linkModelList;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $recordModel->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkhint' => \App\Language::translate('LBL_GO_TO_PREVIEW', $moduleName),
- 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
$moduleName = $recordModel->getModuleName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return parent::getDetailViewLinks($linkParams);
- 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
'linkdata' => [
- 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
$linkModelList = parent::getDetailViewLinks($linkParams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getRecord()->isReadOnly() || \App\RequestUtil::getBrowserInfo()->ie) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-outline-dark btn-sm js-show-article-preview',
- 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
'module-name' => $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vueId' => 'ArticlePreview',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList[$relatedLink->getType()][] = $relatedLink;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relatedLinkEntries as $relatedLinkEntry) {
- 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 getDetailViewLinks(array $linkParams): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-expand',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => \App\Language::translate('LBL_GO_TO_PREVIEW', $moduleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedLinks[] = Vtiger_Link_Model::getInstanceFromValues($relatedLinkEntry);
- 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
'linktype' => 'DETAIL_VIEW_ADDITIONAL',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedLinks = [];
- Exclude checks
Class name "KnowledgeBase_DetailView_Model" is not in camel caps format Open
class KnowledgeBase_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks