YetiForceCompany/YetiForceCRM

View on GitHub
modules/Accounts/models/Record.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class 'CRMEntity' in method 'getAccountHierarchy'.
Open

        $focus = CRMEntity::getInstance($this->getModuleName());
Severity: Minor
Found in modules/Accounts/models/Record.php by phpmd

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 'getAccountHierarchy'.
Open

                $recordModel = Vtiger_Record_Model::getCleanInstance('Accounts');
Severity: Minor
Found in modules/Accounts/models/Record.php by phpmd

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 \CRMEntity::getAccountHierarchy
Open

        $hierarchy = $focus->getAccountHierarchy($this->getId());
Severity: Critical
Found in modules/Accounts/models/Record.php by phan

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

class Accounts_Record_Model extends Vtiger_Record_Model

The class Accounts_Record_Model is not named in CamelCase.
Open

class Accounts_Record_Model extends Vtiger_Record_Model
{
    /**
     * Function returns the details of Accounts Hierarchy.
     *
Severity: Minor
Found in modules/Accounts/models/Record.php by phpmd

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

    /**

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

    {

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

            $link = $accountInfo[0]['data'];

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

            if (!empty($matches)) {

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

     * @return array

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

                $recordModel->setId($accountId);

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

     *

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

    public function getAccountHierarchy()

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

    }

Line exceeds 120 characters; contains 156 characters
Open

                $hierarchy['entries'][$accountId][0]['data'] = ($dashes[0] ?? '') . '<a href=' . $recordModel->getDetailViewUrl() . '>' . $name[2] . '</a>';

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

            }

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

            preg_match('/<a href="+/', $link, $matches);

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

                $hierarchy['entries'][$accountId][0]['data'] = ($dashes[0] ?? '') . '<a href=' . $recordModel->getDetailViewUrl() . '>' . $name[2] . '</a>';

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

        return $hierarchy;

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

        $focus = CRMEntity::getInstance($this->getModuleName());

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

        foreach ($hierarchy['entries'] as $accountId => $accountInfo) {

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

     * Function returns the details of Accounts Hierarchy.

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

                $recordModel = Vtiger_Record_Model::getCleanInstance('Accounts');

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

                preg_match('/[.\s]+/', $link, $dashes);

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

        $hierarchy = $focus->getAccountHierarchy($this->getId());

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

                preg_match('/<a(.*)>(.*)<\\/a>/i', $link, $name);

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

class Accounts_Record_Model extends Vtiger_Record_Model

There are no issues that match your filters.

Category
Status