YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Companies/models/Module.php

Summary

Maintainability
A
0 mins
Test Coverage
D
68%

Missing class import via use statement (line '96', column '9').
Open

            (new \App\Db\Query())->select(['subindustry'])->from('vtiger_subindustry')->orderBy('sortorderid')->column()

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

Missing class import via use statement (line '95', column '9').
Open

            (new \App\Db\Query())->select(['industry'])->from('vtiger_industry')->orderBy('sortorderid')->column(),

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

syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)
Open

    public static array $formFields = [

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

class Settings_Companies_Module_Model extends Settings_Vtiger_Module_Model

The class Settings_Companies_Module_Model is not named in CamelCase.
Open

class Settings_Companies_Module_Model extends Settings_Vtiger_Module_Model
{
    /**
     * @inheritdoc
     */

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 $b. Configured minimum length is 3.
Open

        usort($columnNames, function ($a, $b) use ($editFields) {

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

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

        usort($columnNames, function ($a, $b) use ($editFields) {

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

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

     * @inheritdoc

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

        'name' => 'LBL_NAME',

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

        return false;

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

        'website' => 'LBL_WEBSITE',

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 $name = 'Companies';

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 string URL

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

    public function getDefaultUrl(): string

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 $baseTable = 's_yf_companies';

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 array $formFields = [

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

        return 'index.php?parent=Settings&module=Companies&view=Edit';

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

    public $listFields = [

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

        'website' => [

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 $baseIndex = 'id';

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

            'infoText' => 'LBL_VAT_ID_INFO',

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

        'name' => [],

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 column names.

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

     *

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

     * List of fields in form.

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

     * @var array

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

        'country' => [],

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

     * @return bool

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

     * Function to get the url for default view of the module.

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

     * New entities mustn't be created.

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

        'industry' => [],

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

            'infoText' => 'LBL_WEBSITE_INFO',

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

        'vat_id' => [

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 hasCreatePermissions(): bool

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

            (new \App\Db\Query())->select(['industry'])->from('vtiger_industry')->orderBy('sortorderid')->column(),

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 $tableSchema->getColumnNames();

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

        return false;

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

    public static function getFormFields(): 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

        $tableSchema = \App\Db::getInstance('admin')->getTableSchema('s_#__companies', true);

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

        return array_merge(

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

        unset($columnNames[array_search('id', $columnNames)]);

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 string[]

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

        return static::$formFields;

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_search($a, $editFields) < array_search($b, $editFields) ? -1 : 1;

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

        if ($tableSchema) {

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

    }

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

        $editFields = array_keys(self::$formFields);

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

     * Return list fields in form.

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

        return $columnNames;

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

     * @return array|false

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

    public static function getColumnNames()

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

     * Names of fields.

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 getIndustryList(): 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

    public function getNameFields()

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

            (new \App\Db\Query())->select(['subindustry'])->from('vtiger_subindustry')->orderBy('sortorderid')->column()

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

        $columnNames = self::getColumnNames();

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 bool|array

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

        usort($columnNames, function ($a, $b) use ($editFields) {

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

class Settings_Companies_Module_Model extends Settings_Vtiger_Module_Model

There are no issues that match your filters.

Category
Status