YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
25 mins
Test Coverage
F
0%

Function save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function save($params)
    {
        $db = App\Db::getInstance();
        $name = $params['name'];
        $tabId = (int) $params['tabid'];
Severity: Minor
Found in modules/Settings/Search/models/Module.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Missing class import via use statement (line '114', column '21').
Open

            $subQuery = (new \App\Db\Query())->select(['crmid'])->from('vtiger_crmentity')->where(['setype' => $moduleName]);

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 '85', column '15').
Open

                throw new \App\Exceptions\AppException('ERR_NOT_ALLOWED_VALUE');

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 '111', column '9').
Open

            (new \App\BatchMethod(['method' => '\App\User::updateLabels', 'params' => [0]]))->save();

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 '136', column '72').
Open

        $db->createCommand()->update('vtiger_entityname', ['sequence' => new yii\db\Expression($case)], ['tabid' => $tabIdList])->execute();

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 '52', column '22').
Open

        $dataReader = (new \App\Db\Query())->select(['vtiger_field.tabid', 'vtiger_field.columnname', 'vtiger_field.fieldlabel', 'vtiger_blocks.blocklabel'])

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 getFieldFromModule has a boolean flag argument $blocks, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function getFieldFromModule($blocks = true)

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

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

    public static function getModulesEntity($tabId = false, $onlyActive = 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 '21', column '17').
Open

        $query = (new \App\Db\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

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

    public static function getModulesEntity($tabId = false, $onlyActive = 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

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

        } else {
            $query->from(('vtiger_entityname'));

            if ($tabId) {
                $query->where(['tabid' => $tabId]);

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\Db' in method 'save'.
Open

        $db = App\Db::getInstance();

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\Db' in method 'updateLabels'.
Open

        $db = App\Db::getInstance();

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\Module' in method 'updateLabels'.
Open

        $moduleName = App\Module::getModuleName((int) $params['tabid']);

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 getFieldFromModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $fields[$row['tabid']][$row['columnname']] = $row;
            }

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\Log' in method 'updateSequenceNumber'.
Open

        \App\Log::trace('Exiting Settings_Search_Module_Model::updateSequenceNumber() method ...');

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 'save'.
Open

        \App\Cache::delete('ModuleEntityInfo', '');

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\Log' in method 'updateSequenceNumber'.
Open

        \App\Log::trace('Entering Settings_Search_Module_Model::updateSequenceNumber() method ...');

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\Db' in method 'updateSequenceNumber'.
Open

        $db = App\Db::getInstance();

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 updateLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $db->createCommand()->delete('u_#__crmentity_search_label', ['tabid' => $params['tabid']])->execute();
            $subQuery = (new \App\Db\Query())->select(['crmid'])->from('vtiger_crmentity')->where(['setype' => $moduleName]);
            $db->createCommand()->delete('u_#__crmentity_label', ['crmid' => $subQuery])->execute();
        }

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

Define a constant instead of duplicating this literal "tabid" 12 times.
Open

                $query->where(['tabid' => $tabId]);

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 "vtiger_entityname" 5 times.
Open

            $query->select(['vtiger_entityname.*'])->from('vtiger_entityname')->leftJoin('vtiger_tab', 'vtiger_entityname.tabid = vtiger_tab.tabid')

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 "value" 4 times.
Open

            if (empty($params['value']) || array_diff($params['value'], array_keys(self::getFieldFromModule(false)[$tabId]))) {

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.

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

                $query->where(['tabid' => $tabId]);
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $query->select(['vtiger_entityname.*'])->from('vtiger_entityname')->leftJoin('vtiger_tab', 'vtiger_entityname.tabid = vtiger_tab.tabid')
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $query->from(('vtiger_entityname'));
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

Call to method read from undeclared class \yii\db\DataReader
Open

        while ($row = $dataReader->read()) {
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('Exiting Settings_Search_Module_Model::updateSequenceNumber() method ...');
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

Call to method close from undeclared class \yii\db\DataReader
Open

        $dataReader->close();
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $db->createCommand()->delete('u_#__crmentity_label', ['crmid' => $subQuery])->execute();
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

        $query->orderBy('vtiger_entityname.sequence');
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $case .= " WHEN tabid = {$db->quoteValue($tabId)} THEN {$db->quoteValue($newModuleSequence['sequence'])}";
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $db->createCommand()
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

Call to method __construct from undeclared class \yii\db\Expression
Open

        $db->createCommand()->update('vtiger_entityname', ['sequence' => new yii\db\Expression($case)], ['tabid' => $tabIdList])->execute();
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $subQuery = (new \App\Db\Query())->select(['crmid'])->from('vtiger_crmentity')->where(['setype' => $moduleName]);
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $db->createCommand()
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

Call to method trace from undeclared class \App\Log
Open

        \App\Log::trace('Entering Settings_Search_Module_Model::updateSequenceNumber() method ...');
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

            $db->createCommand()->delete('u_#__crmentity_search_label', ['tabid' => $params['tabid']])->execute();
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

Default value for int $tabId can't be false
Open

    public static function getModulesEntity($tabId = false, $onlyActive = false)

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

        $db->createCommand()->update('vtiger_entityname', ['sequence' => new yii\db\Expression($case)], ['tabid' => $tabIdList])->execute();
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

        $dataReader = (new \App\Db\Query())->select(['vtiger_field.tabid', 'vtiger_field.columnname', 'vtiger_field.fieldlabel', 'vtiger_blocks.blocklabel'])
Severity: Critical
Found in modules/Settings/Search/models/Module.php by phan

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

class Settings_Search_Module_Model extends Settings_Vtiger_Module_Model

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

        $db = App\Db::getInstance();

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

        $db = App\Db::getInstance();

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

        $db = App\Db::getInstance();

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

The class Settings_Search_Module_Model is not named in CamelCase.
Open

class Settings_Search_Module_Model extends Settings_Vtiger_Module_Model
{
    /**
     * Get entity modules.
     *

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

            $query->select(['vtiger_entityname.*'])->from('vtiger_entityname')->leftJoin('vtiger_tab', 'vtiger_entityname.tabid = vtiger_tab.tabid')

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

            $moduleEntity[$row['tabid']] = $row;

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

     * Save parameters.

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 array $modulesSequence

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

                $query->where(['tabid' => $tabId]);

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

    }

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

                $fields[$row['tabid']][$row['columnname']] = $row;

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

            }

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

                ->update('vtiger_entityname', [$name => implode(',', $params['value'])], ['tabid' => $tabId])

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

        \App\Cache::delete('ModuleEntityInfo', '');

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

    public static function updateSequenceNumber($modulesSequence)

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

        $dataReader = (new \App\Db\Query())->select(['vtiger_field.tabid', 'vtiger_field.columnname', 'vtiger_field.fieldlabel', 'vtiger_blocks.blocklabel'])

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

            ->from('vtiger_field')

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

                throw new \App\Exceptions\AppException('ERR_NOT_ALLOWED_VALUE');

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

            $db->createCommand()

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

        $moduleName = App\Module::getModuleName((int) $params['tabid']);

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

        $db = App\Db::getInstance();

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

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

                ->where(['vtiger_tab.presence' => 0]);

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

        return true;

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

    public static function updateLabels($params): void

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

     * Update sequence number.

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

            $tabIdList[] = $tabId;

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

        $query->orderBy('vtiger_entityname.sequence');

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

        return $moduleEntity;

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

     * @param mixed $blocks

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

    {

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

        $dataReader->close();

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

    public static function save($params)

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 (empty($params['value']) || array_diff($params['value'], array_keys(self::getFieldFromModule(false)[$tabId]))) {

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

                ->execute();

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

     */

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

            $db->createCommand()->delete('u_#__crmentity_label', ['crmid' => $subQuery])->execute();

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

     *

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

            $tabId = $newModuleSequence['tabid'];

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  $tabId

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

            $query->from(('vtiger_entityname'));

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

        $dataReader = $query->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 static function getFieldFromModule($blocks = true)

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

        $fields = [];

Line exceeds 120 characters; contains 127 characters
Open

            if (empty($params['value']) || array_diff($params['value'], array_keys(self::getFieldFromModule(false)[$tabId]))) {

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

                ->update('vtiger_entityname', ['turn_off' => (int) $params['value']], ['tabid' => $tabId])

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

                ->execute();

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

            ->createCommand()

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\BatchMethod(['method' => '\App\User::updateLabels', 'params' => [0]]))->save();

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

        $moduleEntity = [];

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

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

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

        } elseif ('turn_off' === $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

            $case .= " WHEN tabid = {$db->quoteValue($tabId)} THEN {$db->quoteValue($newModuleSequence['sequence'])}";

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

        $db->createCommand()->update('vtiger_entityname', ['sequence' => new yii\db\Expression($case)], ['tabid' => $tabIdList])->execute();

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

    public static function getModulesEntity($tabId = false, $onlyActive = false)

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

            ->where(['not in', 'uitype', [15, 16, 52, 53, 56, 70, 99, 120]])

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

            }

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

            $db->createCommand()

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

     * @param array $params

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

        if ($onlyActive) {

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

     */

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

        $db = App\Db::getInstance();

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

     * Update labels.

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

    {

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

            $db->createCommand()->delete('u_#__crmentity_search_label', ['tabid' => $params['tabid']])->execute();

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

        $db = App\Db::getInstance();

Line exceeds 120 characters; contains 157 characters
Open

        $dataReader = (new \App\Db\Query())->select(['vtiger_field.tabid', 'vtiger_field.columnname', 'vtiger_field.fieldlabel', 'vtiger_blocks.blocklabel'])

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

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

     *

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

     * @return void

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

        $case = ' CASE ';

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

        foreach ($modulesSequence as $newModuleSequence) {

Line exceeds 120 characters; contains 140 characters
Open

        $db->createCommand()->update('vtiger_entityname', ['sequence' => new yii\db\Expression($case)], ['tabid' => $tabIdList])->execute();

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

        while ($row = $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

            ->andWhere(['presence' => [0, 2]])

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

        if ('searchcolumn' === $name || 'fieldname' === $name) {

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

        \App\Log::trace('Entering Settings_Search_Module_Model::updateSequenceNumber() method ...');

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

        \App\Log::trace('Exiting Settings_Search_Module_Model::updateSequenceNumber() method ...');

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 $onlyActive

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

    {

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

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

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

     * @param array $params

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

        $name = $params['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

     * Get entity modules.

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

            if ($tabId) {

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

            if ($blocks) {

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

        $tabId = (int) $params['tabid'];

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

            $subQuery = (new \App\Db\Query())->select(['crmid'])->from('vtiger_crmentity')->where(['setype' => $moduleName]);

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

                $fields[$row['tabid']][$row['blocklabel']][$row['columnname']] = $row;

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

        return $fields;

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

     *

Line exceeds 120 characters; contains 125 characters
Open

            $subQuery = (new \App\Db\Query())->select(['crmid'])->from('vtiger_crmentity')->where(['setype' => $moduleName]);

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

        $tabIdList = [];

Line exceeds 120 characters; contains 148 characters
Open

            $query->select(['vtiger_entityname.*'])->from('vtiger_entityname')->leftJoin('vtiger_tab', 'vtiger_entityname.tabid = vtiger_tab.tabid')

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

            ->innerJoin('vtiger_blocks', 'vtiger_blocks.blockid = vtiger_field.block')

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

        if ('Users' === $moduleName) {

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

        }

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

        $case .= ' END ';

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

class Settings_Search_Module_Model extends Settings_Vtiger_Module_Model

There are no issues that match your filters.

Category
Status