YetiForceCompany/YetiForceCRM

View on GitHub
modules/IStorages/models/RelationListView.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '16', column '22').
Open

            $qtyInStock = 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 'App\Config' in method 'getHeaders'.
Open

            if (App\Config::module('IStorages', 'allowSetQtyProducts', false) && App\Privilege::isPermitted('IStorages', 'SetQtyProducts')) {

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 'App\Privilege' in method 'getHeaders'.
Open

            if (App\Config::module('IStorages', 'allowSetQtyProducts', false) && App\Privilege::isPermitted('IStorages', 'SetQtyProducts')) {

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_Module_Model' in method 'getHeaders'.
Open

            $qtyInStock->setModule(Vtiger_Module_Model::getInstance('Products'));

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

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

class IStorages_RelationListView_Model extends Vtiger_RelationListView_Model

The class IStorages_RelationListView_Model is not named in CamelCase.
Open

class IStorages_RelationListView_Model extends Vtiger_RelationListView_Model
{
    public function getHeaders()
    {
        $headerFields = parent::getHeaders();

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

            $qtyInStock->setModule(Vtiger_Module_Model::getInstance('Products'));

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

        }

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

            $qtyInStock->set('label', 'FL_QTY_IN_STOCK');

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

            }

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

            $headerFields[$qtyInStock->getName()] = $qtyInStock;

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

                $qtyInStock->set('isEditable', true);

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

            $qtyInStock = new Vtiger_Field_Model();

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

            if (App\Config::module('IStorages', 'allowSetQtyProducts', false) && App\Privilege::isPermitted('IStorages', 'SetQtyProducts')) {

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

        $headerFields = parent::getHeaders();

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

        if ('Products' == $this->getRelationModel()->get('modulename') && 'getManyToMany' == $this->getRelationModel()->get('name')) {

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

            $qtyInStock->set('name', 'qtyproductinstock');

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

            $qtyInStock->set('fieldDataType', 'double');

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

            $qtyInStock->set('fromOutsideList', true);

Line exceeds 120 characters; contains 134 characters
Open

        if ('Products' == $this->getRelationModel()->get('modulename') && 'getManyToMany' == $this->getRelationModel()->get('name')) {

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

        return $headerFields;

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

    public function getHeaders()

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

            $qtyInStock->set('column', $qtyInStock->getName());

Line exceeds 120 characters; contains 141 characters
Open

            if (App\Config::module('IStorages', 'allowSetQtyProducts', false) && App\Privilege::isPermitted('IStorages', 'SetQtyProducts')) {

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

class IStorages_RelationListView_Model extends Vtiger_RelationListView_Model

There are no issues that match your filters.

Category
Status