YetiForceCompany/YetiForceCRM

View on GitHub
app/BatchMethod.php

Summary

Maintainability
A
25 mins
Test Coverage
D
61%

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

    public function execute()
    {
        try {
            $this->setStatus(static::STATUS_RUNNING);
            if (\is_callable($this->get('method'))) {
Severity: Minor
Found in app/BatchMethod.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

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

    public function __construct($values = [], $encode = true)
Severity: Minor
Found in app/BatchMethod.php by phpmd

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

            } else {
                throw new Exceptions\AppException("ERR_CONTENTS_VARIABLE_CANT_CALLED_FUNCTION||{$this->get('method')}", 406);
            }
Severity: Minor
Found in app/BatchMethod.php by phpmd

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 = Db::getInstance('admin');
Severity: Minor
Found in app/BatchMethod.php by phpmd

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

        } else {
            if ($this->isExists()) {
                return false;
            }
            $this->value['created_time'] = date('Y-m-d H:i:s');
Severity: Minor
Found in app/BatchMethod.php by phpmd

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\Json' in method '__construct'.
Open

            $values['params'] = Json::encode($values['params']);
Severity: Minor
Found in app/BatchMethod.php by phpmd

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

            } else {
                $this->setStatus(static::STATUS_HALTED);
            }
Severity: Minor
Found in app/BatchMethod.php by phpmd

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\User' in method '__construct'.
Open

        $values['userid'] = $values['userid'] ?? User::getCurrentUserId();
Severity: Minor
Found in app/BatchMethod.php by phpmd

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\Json' in method 'execute'.
Open

                \call_user_func_array($this->get('method'), Json::decode($this->get('params')));
Severity: Minor
Found in app/BatchMethod.php by phpmd

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

        return (new Db\Query())->from('s_#__batchmethod')->where(['method' => $this->get('method'), 'params' => $this->get('params')])->exists(Db::getInstance('admin'));
Severity: Minor
Found in app/BatchMethod.php by phpmd

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

            Log::error($ex->getMessage());
Severity: Minor
Found in app/BatchMethod.php by phpmd

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 "s_#__batchmethod" 7 times.
Open

            $result = $db->createCommand()->update('s_#__batchmethod', $this->getData(), ['id' => $this->get('id')])->execute();
Severity: Critical
Found in app/BatchMethod.php by sonar-php

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

        'params' => 'string',
Severity: Critical
Found in app/BatchMethod.php by sonar-php

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

        'status' => 'integer',
Severity: Critical
Found in app/BatchMethod.php by sonar-php

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

        $db = Db::getInstance('admin');
Severity: Critical
Found in app/BatchMethod.php by sonar-php

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

        'method' => 'string',
Severity: Critical
Found in app/BatchMethod.php by sonar-php

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

        'userid' => 'integer',
Severity: Critical
Found in app/BatchMethod.php by sonar-php

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

        return (new Db\Query())->from('s_#__batchmethod')->where(['method' => $this->get('method'), 'params' => $this->get('params')])->exists(Db::getInstance('admin'));
Severity: Critical
Found in app/BatchMethod.php by phan

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

        return Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['method' => $this->get('method'), 'params' => $this->get('params')])->execute();
Severity: Critical
Found in app/BatchMethod.php by phan

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

            $result = $db->createCommand()->insert('s_#__batchmethod', $this->getData())->execute();
Severity: Critical
Found in app/BatchMethod.php by phan

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

        Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['id' => $this->get('id')])->execute();
Severity: Critical
Found in app/BatchMethod.php by phan

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

        Db::getInstance('log')->createCommand()->insert('l_#__batchmethod', [
Severity: Critical
Found in app/BatchMethod.php by phan

Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

        $values['userid'] = $values['userid'] ?? User::getCurrentUserId();
Severity: Critical
Found in app/BatchMethod.php by phan

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

        Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['method' => $method])->execute();
Severity: Critical
Found in app/BatchMethod.php by phan

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

            $result = $db->createCommand()->update('s_#__batchmethod', $this->getData(), ['id' => $this->get('id')])->execute();
Severity: Critical
Found in app/BatchMethod.php by phan

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

            Log::error($ex->getMessage());
Severity: Critical
Found in app/BatchMethod.php by phan

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

        $result = Db::getInstance('admin')->createCommand()->update('s_#__batchmethod', ['status' => $status], ['id' => $this->get('id')])->execute();
Severity: Critical
Found in app/BatchMethod.php by phan

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

        $db = Db::getInstance('admin');
Severity: Minor
Found in app/BatchMethod.php by phpmd

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

    /** Enebled */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    ];
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            if ($this->isExists()) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @return bool
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

                $this->setStatus(static::STATUS_HALTED);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function __construct($values = [], $encode = true)
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Save.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        return (new Db\Query())->from('s_#__batchmethod')->where(['method' => $this->get('method'), 'params' => $this->get('params')])->exists(Db::getInstance('admin'));
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    private $previousStatus;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        $values['status'] = $values['status'] ?? static::STATUS_ENABLED;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            } else {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        'status' => 'integer',
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function isExists(): bool
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    const STATUS_ENABLED = 1;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function execute()
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /** Running     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

                throw new Exceptions\AppException("ERR_CONTENTS_VARIABLE_CANT_CALLED_FUNCTION||{$this->get('method')}", 406);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /** Previous status */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        try {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        if ($result) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    const STATUS_RUNNING = 2;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    const STATUS_HALTED = 3;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        'userid' => 'integer',
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function save()
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            if ($this->previousStatus === static::STATUS_HALTED) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Delete entries with the same parameters.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @param string $message
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        Db::getInstance('log')->createCommand()->insert('l_#__batchmethod', [
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        'method' => 'string',
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @param bool  $encode
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @return bool
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

                $this->delete();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $this->set('status', $status);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        $values['userid'] = $values['userid'] ?? User::getCurrentUserId();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        } else {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        $this->previousStatus = $this->get('status');
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $this->setStatus(static::STATUS_RUNNING);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

                \call_user_func_array($this->get('method'), Json::decode($this->get('params')));
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

                $this->log($ex->__toString());
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @param int $status
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

Line exceeds 120 characters; contains 150 characters
Open

        $result = Db::getInstance('admin')->createCommand()->update('s_#__batchmethod', ['status' => $status], ['id' => $this->get('id')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Function verifies if a duplicate of the entry already exists.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

Line exceeds 120 characters; contains 125 characters
Open

                throw new Exceptions\AppException("ERR_CONTENTS_VARIABLE_CANT_CALLED_FUNCTION||{$this->get('method')}", 406);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $this->setStatus(static::STATUS_COMPLETED);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            'message' => $message,
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /** Completed */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * BatchMethod constructor.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $this->value['id'] = $db->getLastInsertID('s_#__batchmethod_id_seq');
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            if (\is_callable($this->get('method'))) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        } catch (\Throwable $ex) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        return $this->get('status') === static::STATUS_COMPLETED;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        $this->previousStatus = $values['status'];
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

                return false;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Execute.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            Log::error($ex->getMessage());
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Set status.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function delete()
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        return Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['method' => $this->get('method'), 'params' => $this->get('params')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @throws \App\Exceptions\AppException
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        parent::__construct($values);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        if ($this->get('id')) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $result = $db->createCommand()->update('s_#__batchmethod', $this->getData(), ['id' => $this->get('id')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $this->value['created_time'] = date('Y-m-d H:i:s');
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['id' => $this->get('id')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Log.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @return bool
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Delete.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function deleteDuplicate(): bool
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    private function log($message)
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $values['params'] = Json::encode($values['params']);
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            $result = $db->createCommand()->insert('s_#__batchmethod', $this->getData())->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        return (bool) $result;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            } else {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        $result = Db::getInstance('admin')->createCommand()->update('s_#__batchmethod', ['status' => $status], ['id' => $this->get('id')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Function check is status completed.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /** Halted */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    protected $allowedFields = [
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @param array $values
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

Line exceeds 120 characters; contains 169 characters
Open

        return (new Db\Query())->from('s_#__batchmethod')->where(['method' => $this->get('method'), 'params' => $this->get('params')])->exists(Db::getInstance('admin'));
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * @param string $method
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public static function deleteByMethod(string $method): void
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            'userid' => $this->get('userid'),
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

Line exceeds 120 characters; contains 166 characters
Open

        return Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['method' => $this->get('method'), 'params' => $this->get('params')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    const STATUS_COMPLETED = 4;
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /** @var array [name => type, ...] */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        'params' => 'string',
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        if ($encode) {
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        $db = Db::getInstance('admin');
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

            $result = $db->createCommand()->update('s_#__batchmethod', $this->getData(), ['id' => $this->get('id')])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function setStatus(int $status)
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     */
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        Db::getInstance('admin')->createCommand()->delete('s_#__batchmethod', ['method' => $method])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            'params' => $this->get('params'),
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

        ])->execute();
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    public function isCompleted()
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

     * Delete by method.
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            'status' => $this->get('status'),
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            'date' => date('Y-m-d H:i:s'),
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

            'method' => $this->get('method'),
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    }
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/BatchMethod.php by phpcodesniffer

There are no issues that match your filters.

Category
Status