YetiForceCompany/YetiForceCRM

View on GitHub
modules/SSalesProcesses/models/Field.php

Summary

Maintainability
A
0 mins
Test Coverage
D
60%

The method getValidator uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $validator = parent::getValidator();
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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

class SSalesProcesses_Field_Model extends Vtiger_Field_Model

The class SSalesProcesses_Field_Model is not named in CamelCase.
Open

class SSalesProcesses_Field_Model extends Vtiger_Field_Model
{
    /**
     * Function returns special validator for fields.
     *

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

     * @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

     * Function returns special validator for fields.

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

    public function getValidator()

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

    /**

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

            $validator[] = ['name' => 'greaterThanDependentField',

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

        $validator = [];

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

        return $validator;

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

     *

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

                'params' => ['startdate',  $this->getName()], ];

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

        } elseif ('estimated_margin' === $this->getName()) {

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

        if ('estimated_date' === $this->getName()) {

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

                'params' => ['estimated', $this->getName()], ];

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

        } else {

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

            $validator = parent::getValidator();

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

            $validator[] = ['name' => 'lessThanDependentField',

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

class SSalesProcesses_Field_Model extends Vtiger_Field_Model

There are no issues that match your filters.

Category
Status