YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSEmployees/models/DetailView.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class 'Vtiger_Link_Model' in method 'getDetailViewLinks'.
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',

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

        $linkModelLists = parent::getDetailViewLinks($linkParams);
Severity: Critical
Found in modules/OSSEmployees/models/DetailView.php by phan

Class extends undeclared class \Vtiger_DetailView_Model
Open

class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
Severity: Critical
Found in modules/OSSEmployees/models/DetailView.php by phan

Call to undeclared method \OSSEmployees_DetailView_Model::getRecord
Open

            $linkURL = 'index.php?module=OSSEmployees&view=EmployeeHierarchy&record=' . $this->getRecord()->getId();
Severity: Critical
Found in modules/OSSEmployees/models/DetailView.php by phan

Call to undeclared method \OSSEmployees_DetailView_Model::getRecord
Open

        if (!$this->getRecord()->isReadOnly()) {
Severity: Critical
Found in modules/OSSEmployees/models/DetailView.php by phan

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model

The class OSSEmployees_DetailView_Model is not named in CamelCase.
Open

class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
{
    /** {@inheritdoc} */
    public function getDetailViewLinks(array $linkParams): array
    {

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

        if (!$this->getRecord()->isReadOnly()) {

Spaces must be used to indent lines; tabs are not allowed
Open

                'linkhint' => 'LBL_SHOW_EMPLOYEES_HIERARCHY',

Spaces must be used to indent lines; tabs are not allowed
Open

            $linkURL = 'index.php?module=OSSEmployees&view=EmployeeHierarchy&record=' . $this->getRecord()->getId();

Spaces must be used to indent lines; tabs are not allowed
Open

                'linktype' => 'DETAIL_VIEW_BASIC',

Spaces must be used to indent lines; tabs are not allowed
Open

                'linkurl' => 'javascript:OSSEmployees_Detail_Js.triggerEmployeeHierarchy("' . $linkURL . '");',

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getDetailViewLinks(array $linkParams): array

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

            ]);

Spaces must be used to indent lines; tabs are not allowed
Open

            $linkModelLists['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([

Spaces must be used to indent lines; tabs are not allowed
Open

                'linkicon' => 'yfi-hierarchy',

Spaces must be used to indent lines; tabs are not allowed
Open

        $linkModelLists = parent::getDetailViewLinks($linkParams);

Spaces must be used to indent lines; tabs are not allowed
Open

                'linkclass' => 'btn-outline-dark btn-sm',

Spaces must be used to indent lines; tabs are not allowed
Open

        return $linkModelLists;

Class name "OSSEmployees_DetailView_Model" is not in camel caps format
Open

class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model

There are no issues that match your filters.

Category
Status