YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '64', column '25').
Open

        $queryGenerator = new \App\QueryGenerator('ModComments');
Severity: Minor
Found in modules/ModComments/models/Module.php by phpmd

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 'VTWorkflowUtils' in method 'getSettingLinks'.
Open

        if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) {
Severity: Minor
Found in modules/ModComments/models/Module.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 'deleteForRecord'.
Open

            $recordModel = \Vtiger_Record_Model::getInstanceById($id, $queryGenerator->getModule());
Severity: Minor
Found in modules/ModComments/models/Module.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_Loader' in method 'getSettingLinks'.
Open

        Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
Severity: Minor
Found in modules/ModComments/models/Module.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

Saw unextractable annotation for comment '* @param <type> $parentRecord - parent record for which comment need to be added'</type>
Open

     * @param <type> $parentRecord - parent record for which comment need to be added

Saw unextractable annotation for comment '* @return <array> List of Vtiger_Link_Model instances'</array>
Open

     * @return <Array> List of Vtiger_Link_Model instances

Call to method __construct from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
Open

        $queryGenerator = new \App\QueryGenerator('ModComments');
Severity: Critical
Found in modules/ModComments/models/Module.php by phan

Call to method setFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
Open

        $dataReader = $queryGenerator->setFields(['id'])->setStateCondition('All')->addNativeCondition(['related_to' => $recordId])->createQuery()->createCommand()->query();
Severity: Critical
Found in modules/ModComments/models/Module.php by phan

Call to method getModule from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
Open

            $recordModel = \Vtiger_Record_Model::getInstanceById($id, $queryGenerator->getModule());
Severity: Critical
Found in modules/ModComments/models/Module.php by phan

Saw unextractable annotation for comment '* @param <array> $linkParams'</array>
Open

     * @param <Array> $linkParams

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

class ModComments_Module_Model extends Vtiger_Module_Model

The class ModComments_Module_Model is not named in CamelCase.
Open

class ModComments_Module_Model extends Vtiger_Module_Model
{
    /**
     * Function to get the Quick Links for the module.
     *
Severity: Minor
Found in modules/ModComments/models/Module.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

Avoid variables with short names like $id. Configured minimum length is 3.
Open

        while ($id = $dataReader->readColumn(0)) {
Severity: Minor
Found in modules/ModComments/models/Module.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

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

     * @return string Url

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

        unset($links['SIDEBARLINK']);

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

        return $this->getCreateRecordUrl() . '&parent_id=' . $parentRecord->getId();

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

        return $links;

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

     * @return <Array> List of Vtiger_Link_Model instances

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

    public function getSettingLinks(): array

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

        Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');

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

        if (VTWorkflowUtils::checkModuleWorkflow($this->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

    /**

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 getCreateRecordUrlWithParent($parentRecord)

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

     * @param <Array> $linkParams

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

     * @param <type> $parentRecord - parent record for which comment need to be added

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

                'linktype' => 'LISTVIEWSETTING',

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

     * @param int $recordId

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

        }

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

        $links = parent::getSideBarLinks($linkParams);

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 getSideBarLinks($linkParams)

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

     * Function to get the create url with parent id set.

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

            $settingsLinks[] = [

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

    }

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

            $recordModel->delete();

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

    {

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

                'linklabel' => 'LBL_EDIT_WORKFLOWS',

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

    /**

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

        while ($id = $dataReader->readColumn(0)) {

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

            $recordModel = \Vtiger_Record_Model::getInstanceById($id, $queryGenerator->getModule());

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

        return $settingsLinks;

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

     * Delete comments associated with record.

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

        }

Line exceeds 120 characters; contains 173 characters
Open

        $dataReader = $queryGenerator->setFields(['id'])->setStateCondition('All')->addNativeCondition(['related_to' => $recordId])->createQuery()->createCommand()->query();

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

        $settingsLinks = [];

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

     */

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

     * Function to get the Quick Links for the module.

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

                'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule=' . $this->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

        $queryGenerator = new \App\QueryGenerator('ModComments');

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

                'linkicon' => 'yfi yfi-workflows-2',

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

            unset($recordModel);

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

    public static function deleteForRecord(int $recordId)

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

        $dataReader = $queryGenerator->setFields(['id'])->setStateCondition('All')->addNativeCondition(['related_to' => $recordId])->createQuery()->createCommand()->query();

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

class ModComments_Module_Model extends Vtiger_Module_Model

There are no issues that match your filters.

Category
Status