YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Vtiger/models/MenuItem.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

The method getInstance has a boolean flag argument $menuModel, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function getInstance($name, $menuModel = false)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Missing class import via use statement (line '180', column '17').
Open

        $query = (new \App\Db\Query())->from(self::$itemsTable)->where(['name' => $name]);

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

The method updatePinStatus has a boolean flag argument $pinned, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function updatePinStatus($pinned = false)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Missing class import via use statement (line '224', column '23').
Open

            $dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();

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\Cache' in method 'getAll'.
Open

        $menuItemModels = \App\Cache::get($cacheName, $key);

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

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

            } else {
                $menuItem->setMenu($rowData['blockid']);
            }

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

Avoid using static access to class '\App\Cache' in method 'getAll'.
Open

        if (!\App\Cache::has($cacheName, $key)) {

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 'Settings_Vtiger_Menu_Model' in method 'setMenu'.
Open

        $this->menu = Settings_Vtiger_Menu_Model::getInstanceById($menuId);

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\Cache' in method 'getAll'.
Open

            \App\Cache::save($cacheName, $key, $menuItemModels);

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 '\Settings_Vtiger_Menu_Model' in method 'getBlock'.
Open

        return \Settings_Vtiger_Menu_Model::getInstanceById($this->getBlockId());

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

Define a constant instead of duplicating this literal "blockid" 3 times.
Open

        return $this->get('blockid');

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "pinned" 3 times.
Open

        $pinStatus = $this->get('pinned');

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Saw unextractable annotation for comment '* @param <settings_vtiger_menu_model> $menu - Settings Menu Model instance'</settings_vtiger_menu_model>
Open

     * @param <Settings_Vtiger_Menu_Model> $menu - Settings Menu Model instance

Returning type false but getInstance() is declared to return \Settings_Vtiger_MenuItem_Model
Open

        return false;

Saw unextractable annotation for comment '* @return <number> - Menu Item Id'</number>
Open

     * @return <Number> - Menu Item Id

Argument 2 (key) is int but \App\Cache::has() takes string defined at /code/app/Cache.php:74
Open

        if (!\App\Cache::has($cacheName, $key)) {

Argument 2 (key) is int but \App\Cache::get() takes string defined at /code/app/Cache.php:61
Open

        $menuItemModels = \App\Cache::get($cacheName, $key);

Reference to undeclared property \Settings_Vtiger_MenuItem_Model->menu
Open

        $this->menu = Settings_Vtiger_Menu_Model::getInstanceById($menuId);

Call to undeclared method \App\Db\Query::from
Open

            $dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();

Reference to undeclared property \Settings_Vtiger_MenuItem_Model->menu (Did you mean $menu)
Open

        $this->menu = $menu;

Call to undeclared method \App\Db::createCommand
Open

        \App\Db::getInstance()->createCommand()->update(self::$itemsTable, ['pinned' => $pinnedStaus], [self::$itemId => $this->getId()])->execute();

Argument 2 (key) is int but \App\Cache::save() takes string defined at /code/app/Cache.php:89
Open

            \App\Cache::save($cacheName, $key, $menuItemModels);

Saw unextractable annotation for comment '* @param <number> $menuId'</number>
Open

     * @param <Number> $menuId

Argument 1 (pinned) is 1 but \Settings_Vtiger_MenuItem_Model::updatePinStatus() takes bool|false defined at /code/modules/Settings/Vtiger/models/MenuItem.php:133
Open

        $this->updatePinStatus(1);

Call to undeclared method \App\Db\Query::from
Open

        $query = (new \App\Db\Query())->from(self::$itemsTable)->where(['name' => $name]);

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

class Settings_Vtiger_MenuItem_Model extends Settings_Vtiger_Menu_Model

The class Settings_Vtiger_MenuItem_Model is not named in CamelCase.
Open

class Settings_Vtiger_MenuItem_Model extends Settings_Vtiger_Menu_Model
{
    /**
     * Active.
     */

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

    public static function getInstanceById(int $id)

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

     */

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

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

        return $this->get(self::$itemId);

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

     * @var string

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

    const ACTIVE = 0;

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

     * @param <Number> $menuId

Line exceeds 120 characters; contains 125 characters
Open

        return 'index.php?module=Vtiger&parent=Settings&action=Basic&mode=updateFieldPinnedStatus&fieldid=' . $this->getId();

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

    public function markPinned()

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

     * Static function to get the list of all the items of the given Menu, all items if Menu is not specified.

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 <Number> - Menu Item 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

     * Function which will disable the field pinned status.

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

    }

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

            $query->andWhere(['blockid' => $menuModel->getId()]);

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

     * Inactive.

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

    const INACTIVE = 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

        return 'index.php?module=Vtiger&parent=Settings&action=Basic&mode=updateFieldPinnedStatus&fieldid=' . $this->getId();

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

                $menuItem->setMenu($rowData['blockid']);

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

            return $menuItem;

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

    }

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

     * @param bool|Settings_Vtiger_Menu_Model $menuModel

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

    public static function getInstance($name, $menuModel = false)

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

        if ($menuModel) {

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

     * Gets block instance.

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

        return $this->get('blockid');

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 pin and unpin action url.

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 which will enable the field as pinned.

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 setMenu($menuId)

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

        $this->menu = Settings_Vtiger_Menu_Model::getInstanceById($menuId);

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 \Settings_Vtiger_Menu_Model::getInstanceById($this->getBlockId());

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

     * Function to set the Menu to which the Item belongs, given Menu Model instance.

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

     * Function to get the module name, to which the Settings Menu Item belongs to.

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

        return 'Settings:' . ($this->getParam('module') ?: 'Vtiger');

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

     * Function to verify whether menuitem is pinned or not.

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

        $pinStatus = $this->get('pinned');

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

     * @param bool $pinned - true to enable , false to disable

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

            $pinnedStaus = 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

        if ($rowData) {

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 getInstanceById(int $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

     * Function to get the Id of the menu item.

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

        return new self($valueMap);

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

                $menuItem->setMenuFromInstance($menuModel);

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

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

     * @return int

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

     * @return string - Module to which the Menu Item belongs

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

        $this->updatePinStatus(1);

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

        $this->updatePinStatus();

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

            $menuItem = self::getInstanceFromArray($rowData);

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

     * @param int $id

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

    public static function getAll(int $blockId = 0, int $active = self::ACTIVE): 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

    protected static $itemId = 'fieldid';

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 <Settings_Vtiger_Menu_Model> $menu - Settings Menu Model instance

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 true to pinned, false to not pinned

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

    protected static $itemsTable = 'vtiger_settings_field';

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 $this;

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 unMarkPinned()

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

    public static function getInstanceFromArray($valueMap)

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

     * @return Settings_Vtiger_MenuItem_Model instance

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

     * @return Settings_Vtiger_MenuItem_Model|null

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 int $active

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

    {

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

     * Active.

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

     * Table index.

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 getId()

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 set the Menu to which the Item belongs, given Menu Id.

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

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

    }

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

     * Function which will update the pin status.

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

    private function updatePinStatus($pinned = false)

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 instance of the Menu Item model given the valuemap 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

        $query = (new \App\Db\Query())->from(self::$itemsTable)->where(['name' => $name]);

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

     * Function to get the instance of the Menu Item model, given item id and Menu instance.

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

        return $this;

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 Settings_Vtiger_MenuItem_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

    public function isPinned()

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

        $pinnedStaus = 0;

Line exceeds 120 characters; contains 149 characters
Open

        \App\Db::getInstance()->createCommand()->update(self::$itemsTable, ['pinned' => $pinnedStaus], [self::$itemId => $this->getId()])->execute();

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

     * @param array $valueMap

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

        $key = $active;

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

                unset($menuItems[$key]);

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

    public function getBlock(): ?Settings_Vtiger_Menu_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

     * Gets block 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

    public function getPinUnpinActionUrl()

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

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

     * @return Settings_Vtiger_Menu_Model|null

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

        $this->menu = $menu;

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 '1' == $pinStatus ? true : false;

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

        if ($pinned) {

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

     * @return Settings_Vtiger_MenuItem_Model instance

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

     * Function to get the instance of the Menu Item model, given name and Menu instance.

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

            if ($menuModel) {

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

        return self::getAll()[$id] ?? null;

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

     *

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

                $fieldId = (int) $rowData[self::$itemId];

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

            $dataReader->close();

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 pinned items.

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

        }

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

            $dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->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

    public function getBlockId()

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

    public function setMenuFromInstance($menu)

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 getModuleName()

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

        }

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

        $rowData = $query->one();

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

     */

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

            $menuItemModels = [];

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

            if (!$menuItem->isPermitted() || 1 !== (int) $menuItem->get('pinned')) {

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

                $menuItemModels[$menuItem->getBlockId()][$fieldId] = $menuItem;

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

                $menuItem = self::getInstanceFromArray($rowData);

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

            \App\Cache::save($cacheName, $key, $menuItemModels);

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

            while ($rowData = $dataReader->read()) {

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

        \App\Db::getInstance()->createCommand()->update(self::$itemsTable, ['pinned' => $pinnedStaus], [self::$itemId => $this->getId()])->execute();

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

     * @param string                          $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

     * @param int $blockId

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

                $menuItemModels[0][$fieldId] = $menuItem;

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

        return $menuItems;

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

        return $menuItemModels[$blockId] ?? [];

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

        $menuItems = self::getAll();

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

     * @return \Settings_Vtiger_MenuItem_Model[]

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

        $cacheName = 'MenuItemAll';

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

        if (!\App\Cache::has($cacheName, $key)) {

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

        foreach ($menuItems as $key => $menuItem) {

Line exceeds 120 characters; contains 149 characters
Open

            $dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();

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

        $menuItemModels = \App\Cache::get($cacheName, $key);

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

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

    }

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

class Settings_Vtiger_MenuItem_Model extends Settings_Vtiger_Menu_Model

There are no issues that match your filters.

Category
Status