YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Inventory/models/Record.php

Summary

Maintainability
A
1 hr
Test Coverage
D
64%

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

    public function save()
    {
        $table = self::getTableNameFromType($this->getType());
        $id = $this->getId();
        if (!empty($id) && $table) {
Severity: Minor
Found in modules/Settings/Inventory/models/Record.php - About 45 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

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

    public function add()
    {
        $table = self::getTableNameFromType($this->getType());
        if ($table) {
            $insertData = [
Severity: Minor
Found in modules/Settings/Inventory/models/Record.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 '212', 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

Missing class import via use statement (line '165', column '13').
Open

        throw new Error('Error occurred while deleting 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 '192', column '15').
Open

        $row = (new \App\Db\Query())->from($table)

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 '135', column '13').
Open

        throw new Error('Error occurred while adding 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 '175', column '22').
Open

        $dataReader = (new \App\Db\Query())->from($table)->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

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

        } else {
            $id = $this->add();
        }

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

        \App\Cache::delete('Inventory', $this->getType());

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

            } else {
                $excludedIds = [];
            }

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 'add'.
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 'CurrencyField' in method 'getValue'.
Open

        return CurrencyField::convertToUserFormat($this->get('value'), null, true);

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 "default" 8 times.
Open

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

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

        return CurrencyField::convertToUserFormat($this->get('value'), null, true);

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 "Taxes" 3 times.
Open

    private static $tableName = ['CreditLimits' => 'a_#__inventory_limits', 'Taxes' => 'a_#__taxes_global', 'Discounts' => 'a_#__discounts_global'];

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

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

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::createCommand
Open

            \App\Db::getInstance()->createCommand()

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

            \App\Db::getInstance()->createCommand()

Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
Open

        return CurrencyField::convertToUserFormat($this->get('value'), null, true);

Saw an @param annotation for taxlabel, but the param list of function add() is empty
Open

     * @param string $taxlabel - tax label name to be added

Saw an @param annotation for taxvalue, but the param list of function add() is empty
Open

     * @param string $taxvalue - tax value to be added

Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
Open

        return CurrencyField::convertToUserFormat($this->get('value'), null, true);

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

            \App\Db::getInstance()->createCommand()

Saw an @param annotation for sh, but the param list of function add() is empty
Open

     * @param string $sh       - sh or empty , if sh passed then the tax will be added in shipping and handling related table

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

            $db->createCommand()

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

        $dataReader = (new \App\Db\Query())->from($table)->createCommand()->query();

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

        $query = (new \App\Db\Query())

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

        $row = (new \App\Db\Query())->from($table)

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

class Settings_Inventory_Record_Model extends \App\Base

The class Settings_Inventory_Record_Model is not named in CamelCase.
Open

class Settings_Inventory_Record_Model extends \App\Base
{
    private $type;

    public function getId()

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

        $id = $this->getId();

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

    public static function getInstanceById($id, $type = '')

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

    public function getName()

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

    public function getValue()

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

    public function getType()

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

        throw new Error('Error occurred while adding value');

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

        throw new Error('Error occurred while deleting value');

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

    private $type;

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

        return $this->get('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

    public function save()

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

        $table = self::getTableNameFromType($this->getType());

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

        if (!empty($id) && $table) {

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

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

                ->delete($table, ['id' => $this->getId()])

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

     * @return void

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

     * @param string $sh       - sh or empty , if sh passed then the tax will be added in shipping and handling related table

Line exceeds 120 characters; contains 125 characters
Open

     * @param string $sh       - sh or empty , if sh passed then the tax will be added in shipping and handling related table

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

                    $this->disableDefaultsTax();

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

        $table = self::getTableNameFromType($this->getType());

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 function getDefault()

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

        $this->type = $type;

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

    public function getEditUrl()

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

    {

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

        $this->clearCache();

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

        $table = self::getTableNameFromType($this->getType());

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

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

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

    public function getStatus()

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

    public function getCreateUrl()

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' => $this->getName(),

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

     * @param string $taxvalue - tax value to be added

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

                'status' => $this->get('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

            \App\Db::getInstance()->createCommand()

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

     * Is default tax value for group.

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

        return $this->type;

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

                    $this->disableDefaultsTax();

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

    public function add()

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

                $insertData['default'] = $this->get('default');

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 clears cache.

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

    public function clearCache(): void

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 ('Taxes' === $this->getType()) {

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

        return $id;

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

            return $db->getLastInsertID($table . '_id_seq');

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

     * Function used to remove all defaults tax settings.

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

        if ($table) {

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

                'name' => $this->getName(),

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 ($table) {

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 used to add the tax type which will do database alterations.

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

        $this->clearCache();

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

    public function delete()

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

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

Line exceeds 120 characters; contains 148 characters
Open

    private static $tableName = ['CreditLimits' => 'a_#__inventory_limits', 'Taxes' => 'a_#__taxes_global', 'Discounts' => 'a_#__discounts_global'];

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

        return static::$tableName[$type];

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

                if ($this->get('default')) {

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

            $id = $this->add();

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

     * @param string $taxlabel - tax label name to be added

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

            }

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

                ->insert($table, $insertData)->execute();

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

        if ($table) {

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 (!$table) {

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

        return $recordModel;

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

                $excludedIds = [];

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 setType($type)

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

    }

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

                'value' => $this->get('value'),

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

            if ('Taxes' === $this->getType()) {

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

                    'default' => 0,

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 CurrencyField::convertToUserFormat($this->get('value'), null, true);

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

     */

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

    private static $tableName = ['CreditLimits' => 'a_#__inventory_limits', 'Taxes' => 'a_#__taxes_global', 'Discounts' => 'a_#__discounts_global'];

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

    {

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

            $updateRows = [

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

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

            $this->clearCache();

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

    public static function getInstanceById($id, $type = '')

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

        $recordModel = new self();

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

            $recordModel->setData($row)->setType($type);

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 '?module=Inventory&parent=Settings&view=ModalAjax&type=' . $this->getType() . '&id=' . $this->getId();

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

            \App\Db::getInstance()->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

        $table = self::getTableNameFromType($this->getType());

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

            return 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

        if (!$table) {

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

        }

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

            $recordModel->setData($row)->setType($type);

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

            ->where(['id' => $id])

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

        return $this->get('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

        \App\Cache::delete('Inventory', $this->getType());

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

        $id = $this->getId();

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

                'status' => $this->get('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

                }

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

                $updateRows['default'] = $this->get('default');

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

            $insertData = [

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

            $recordModel = new self();

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

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

    {

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 '?module=Inventory&parent=Settings&view=ModalAjax&type=' . $this->getType();

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

    public static function getTableNameFromType($type)

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

                if ($this->get('default')) {

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

                ->update($table, [

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

            ->createCommand()->queryOne();

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

            $query->andWhere(['NOT IN', 'id', $excludedIds]);

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

            }

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

            ->where(['name' => $label]);

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

    public static function getDataAll($type)

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

            $recordList[] = $recordModel;

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

        $row = (new \App\Db\Query())->from($table)

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

        }

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

        $recordList = [];

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

        $table = self::getTableNameFromType($type);

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

        if (false !== $row) {

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

        if (!\is_array($excludedIds)) {

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

                $excludedIds = [$excludedIds];

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

            ->from($table)

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 ($query->count() > 0) ? true : 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

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

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

                ->update($table, $updateRows, ['id' => $id])

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

                'value' => $this->get('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

    {

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

            return $recordList;

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

        $table = self::getTableNameFromType($type);

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

    public static function checkDuplicate($label, $excludedIds = [], $type = '')

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

        $table = self::getTableNameFromType($type);

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

        $dataReader = (new \App\Db\Query())->from($table)->createCommand()->query();

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

            if (!empty($excludedIds)) {

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

        if (!empty($excludedIds)) {

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

    {

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

class Settings_Inventory_Record_Model extends \App\Base

There are no issues that match your filters.

Category
Status