YetiForceCompany/YetiForceCRM

View on GitHub
modules/ModComments/models/Relation.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

The method addRelation has a boolean flag argument $params, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function addRelation($sourceRecordId, $destinationRecordIds, $params = false)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '29', column '23').
Open

        $eventHandler = new \App\EventHandler();

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 '\CRMEntity' in method 'addRelation'.
Open

            \CRMEntity::trackLinkedInfo($sourceRecordId);

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

Argument 1 (moduleName) is false but \App\EventHandler::setModuleName() takes string defined at /code/app/EventHandler.php:366
Open

        $eventHandler->setModuleName($sourceModuleName);

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

class ModComments_Relation_Model extends Vtiger_Relation_Model

The class ModComments_Relation_Model is not named in CamelCase.
Open

class ModComments_Relation_Model extends Vtiger_Relation_Model
{
    /** {@inheritdoc} */
    public function addRelation($sourceRecordId, $destinationRecordIds, $params = false)
    {

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

        foreach ($destinationRecordIds as $destinationRecordId) {

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

            $eventHandler->setParams($data);

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

    public function addRelation($sourceRecordId, $destinationRecordIds, $params = false)

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

        }

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

        $data = [

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

        $result = false;

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

        if (!\is_array($destinationRecordIds)) {

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

    public function setExceptionData()

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

        ];

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

            'sourceRecordId' => $sourceRecordId,

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

            'destinationModule' => $this->getRelationModuleModel()->getName(),

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

        ];

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

            'sourceModule' => $sourceModuleName,

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

            $data['destinationRecordId'] = $destinationRecordId;

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

     * Set exceptional data.

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

            'name' => 'getRelatedRecord',

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

        $eventHandler = new \App\EventHandler();

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

        return $result;

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

            'actions' => '',

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

        $this->setData($data);

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

            'CRMEntity' => $this->getParentModuleModel()->getEntityInstance(),

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

        $eventHandler->setModuleName($sourceModuleName);

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

        $sourceModuleName = $this->getParentModuleModel()->getName();

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

            $destinationRecordIds = [$destinationRecordIds];

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

     */

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

            'related_tabid' => $this->getRelationModuleModel()->getId(),

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

            'modulename' => $this->getParentModuleModel()->getName(),

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

        $data = [

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

            $eventHandler->trigger('EntityBeforeLink');

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

            \CRMEntity::trackLinkedInfo($sourceRecordId);

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

            $eventHandler->trigger('EntityAfterLink');

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

        }

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

            'tabid' => $this->getParentModuleModel()->getId(),

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

    }

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

class ModComments_Relation_Model extends Vtiger_Relation_Model

There are no issues that match your filters.

Category
Status