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) {
- Read upRead up
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 = [
- Read upRead up
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())
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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();
}
- Read upRead up
- Exclude checks
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());
- Read upRead up
- Exclude checks
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 = [];
}
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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'];
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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()
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Call to deprecated function \CurrencyField::convertToUserFormat()
defined at /code/include/fields/CurrencyField.php:144
Open
return CurrencyField::convertToUserFormat($this->get('value'), null, true);
- Exclude checks
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
- Exclude checks
Saw an @param annotation for taxvalue,
but the param list of function add()
is empty Open
* @param string $taxvalue - tax value to be added
- Exclude checks
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);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
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
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new \App\Db\Query())->from($table)->createCommand()->query();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from($table)
- Exclude checks
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
- Exclude checks
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()
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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 = '')
- Read upRead up
- Exclude checks
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()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getValue()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getType()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Error('Error occurred while adding value');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Error('Error occurred while deleting value');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('name');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function save()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($this->getType());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($id) && $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function disableDefaultsTax()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->delete($table, ['id' => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
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
- Exclude checks
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
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->disableDefaultsTax();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($this->getType());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefault()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->type = $type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEditUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->clearCache();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($this->getType());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getStatus()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCreateUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $this->getName(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $taxvalue - tax value to be added
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => $this->get('status'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Is default tax value for group.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->disableDefaultsTax();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function add()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$insertData['default'] = $this->get('default');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function clears cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function clearCache(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Taxes' === $this->getType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $db->getLastInsertID($table . '_id_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function used to remove all defaults tax settings.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $this->getName(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Function used to add the tax type which will do database alterations.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->clearCache();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function delete()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
private static $tableName = ['CreditLimits' => 'a_#__inventory_limits', 'Taxes' => 'a_#__taxes_global', 'Discounts' => 'a_#__discounts_global'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$tableName[$type];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->get('default')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $this->add();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $taxlabel - tax label name to be added
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->insert($table, $insertData)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$excludedIds = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setType($type)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => $this->get('value'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Taxes' === $this->getType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default' => 0,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return CurrencyField::convertToUserFormat($this->get('value'), null, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
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'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$updateRows = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->clearCache();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceById($id, $type = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setData($row)->setType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($this->getType());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setData($row)->setType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['id' => $id])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('status');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('Inventory', $this->getType());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => $this->get('status'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$updateRows['default'] = $this->get('default');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$insertData = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordList;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '?module=Inventory&parent=Settings&view=ModalAjax&type=' . $this->getType();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getTableNameFromType($type)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->get('default')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update($table, [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->queryOne();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['NOT IN', 'id', $excludedIds]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['name' => $label]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getDataAll($type)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordList[] = $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from($table)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordList = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($excludedIds)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$excludedIds = [$excludedIds];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from($table)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ($query->count() > 0) ? true : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('default');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update($table, $updateRows, ['id' => $id])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => $this->get('value'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordList;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function checkDuplicate($label, $excludedIds = [], $type = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = self::getTableNameFromType($type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->from($table)->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($excludedIds)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($excludedIds)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Class name "Settings_Inventory_Record_Model" is not in camel caps format Open
class Settings_Inventory_Record_Model extends \App\Base
- Exclude checks