YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Workflows/models/Field.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '47', column '24').
Open

            $commentField = new Vtiger_Field_Model();

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 'Vtiger_AdvancedFilter_Helper' in method 'getAdvancedFilterOpsByFieldType'.
Open

        return Vtiger_AdvancedFilter_Helper::getAdvancedFilterOpsByFieldType();

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_AdvancedFilter_Helper' in method 'getAdvancedFilterOptions'.
Open

        return Vtiger_AdvancedFilter_Helper::getAdvancedFilterOptions();

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 '* @return <array>'</array>
Open

     * @return <Array>

Saw unextractable annotation for comment '* @return <array>'</array>
Open

     * @return <Array>

Saw unextractable annotation for comment '* @return <array> list of Field models <vtiger_field_model>'</vtiger_field_model></array>
Open

     * @return <Array> list of Field models <Vtiger_Field_Model>

Avoid excessively long variable names like $commentFieldModelsList. Keep variable name length under 20.
Open

        $commentFieldModelsList = [];

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

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

class Settings_Workflows_Field_Model extends Vtiger_Field_Model

The class Settings_Workflows_Field_Model is not named in CamelCase.
Open

class Settings_Workflows_Field_Model extends Vtiger_Field_Model
{
    /**
     * Function to get all the supported advanced filter operations.
     *

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

     * Function to get all the supported advanced filter operations.

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 static function getAdvancedFilterOptions()

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

        return Vtiger_AdvancedFilter_Helper::getAdvancedFilterOptions();

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

    {

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 advanced filter option names by Field type.

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 static function getCommentFieldsListForTasks($moduleModel)

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

        $commentsFieldsInfo = ['$(record : Comments 1)$' => 'Last Comment', 'last5Comments' => '$(record : Comments 5)$', 'allComments' => '$(record : Comments)$'];

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

            $commentField = new Vtiger_Field_Model();

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

     * @param Vtiger_Module_Model $moduleModel

Line exceeds 120 characters; contains 164 characters
Open

        $commentsFieldsInfo = ['$(record : Comments 1)$' => 'Last Comment', 'last5Comments' => '$(record : Comments 5)$', 'allComments' => '$(record : Comments)$'];

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

    /**

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

            $commentField->set('label', $fieldLabel);

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

        return $commentFieldModelsList;

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

    public static function getAdvancedFilterOpsByFieldType()

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 comment fields list which are useful in tasks.

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

            $commentField->setModule($moduleModel);

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

            $commentField->set('name', $fieldName);

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

        return Vtiger_AdvancedFilter_Helper::getAdvancedFilterOpsByFieldType();

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

        $commentFieldModelsList = [];

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

     *

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

        foreach ($commentsFieldsInfo as $fieldName => $fieldLabel) {

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

     * @return <Array> list of Field models <Vtiger_Field_Model>

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

        }

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

            $commentFieldModelsList[$fieldName] = $commentField;

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

class Settings_Workflows_Field_Model extends Vtiger_Field_Model

There are no issues that match your filters.

Category
Status