YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/Core/BaseAction.php

Summary

Maintainability
A
1 hr
Test Coverage
B
80%

The class BaseAction has an overall complexity of 57 which is very high. The configured complexity threshold is 50.
Open

class BaseAction
{
    /** @var string[] Allowed methods */
    public $allowedMethod;

Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

Function getUserData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUserData(string $key, string $param = '')
    {
        if (!isset($this->userData[$key])) {
            return null;
        }
Severity: Minor
Found in api/webservice/Core/BaseAction.php - About 1 hr 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 updateUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateUser(array $data = []): void
    {
        if (!\is_array($this->userData['custom_params'])) {
            $this->userData['custom_params'] = \App\Json::isEmpty($this->userData['custom_params']) ? [] : \App\Json::decode($this->userData['custom_params']);
        }
Severity: Minor
Found in api/webservice/Core/BaseAction.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 getUserData() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
Open

    public function getUserData(string $key, string $param = '')
    {
        if (!isset($this->userData[$key])) {
            return null;
        }
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open

    public function getUserData(string $key, string $param = '')
Severity: Critical
Found in api/webservice/Core/BaseAction.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

The class BaseAction has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
Open

class BaseAction
{
    /** @var string[] Allowed methods */
    public $allowedMethod;

Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Missing class import via use statement (line '44', column '14').
Open

            throw new \Api\Core\Exception('Invalid method', 405);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '202', column '21').
Open

            $hierarchy = new \Api\WebservicePremium\BaseModule\Hierarchy();
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '74', column '14').
Open

            throw new \Api\Core\Exception('No sent token', 401);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '100', column '20').
Open

        $userData = (new \App\Db\Query())->select(["$userTable.*", 'sid' => "$sessionTable.id", "$sessionTable.language", "$sessionTable.created", "$sessionTable.changed", "$sessionTable.params"])
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '211', column '14').
Open

            throw new \Api\Core\Exception('No permission to X-PARENT-ID', 403);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '60', column '14').
Open

            throw new \Api\Core\Exception('No permissions for module', 403);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '124', column '14').
Open

            throw new \Api\Core\Exception('Token has expired', 401);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

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 '106', column '14').
Open

            throw new \Api\Core\Exception('Invalid token', 401);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid using static access to class '\App\Record' in method 'getParentCrmId'.
Open

        return \App\Record::getParentRecord($this->getUserCrmId());
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'setUserData'.
Open

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 setUserData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->userData[$key] = $value;
        }
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

            $data['auth'] = \App\Encryption::getInstance()->encrypt(\App\Json::encode(\App\Utils::merge(($this->getUserData('auth') ?? []), $data['auth'])));
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

            $this->userData['custom_params'] = \App\Json::isEmpty($this->userData['custom_params']) ? [] : \App\Json::decode($this->userData['custom_params']);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 assigning values to variables in if clauses and the like (line '150', column '7').
Open

    public function getLanguage(): string
    {
        $language = '';
        if ($userLang = $this->getUserData('language')) {
            $language = $userLang;
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class '\App\Utils' in method 'updateUser'.
Open

            $data['custom_params'] = \App\Json::encode(\App\Utils::merge($this->userData['custom_params'], $data['custom_params']));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\User' in method 'checkPermission'.
Open

        \App\User::setCurrentUserId($this->getUserData('user_id'));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\User' in method 'checkPermission'.
Open

        $userModel = \App\User::getCurrentUserModel();
Severity: Minor
Found in api/webservice/Core/BaseAction.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\PrivilegeQuery' in method 'checkPermission'.
Open

        \App\PrivilegeQuery::setPermissionInterpreter("\\Api\\{$namespace}\\PrivilegeQuery");
Severity: Minor
Found in api/webservice/Core/BaseAction.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 '\Locale' in method 'getLanguage'.
Open

            $language = str_replace('_', '-', \Locale::acceptFromHttp($this->controller->headers['accept-language']));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Record' in method 'getParentCrmId'.
Open

            $parentRecord = \App\Record::getParentRecord($this->getUserCrmId());
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'getUserData'.
Open

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

            $data['preferences'] = \App\Json::encode(\App\Utils::merge($this->userData['preferences'], $data['preferences']));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Record' in method 'getParentCrmId'.
Open

            $hierarchy->moduleName = $parentRecord ? '' : \App\Record::getType($parentRecord);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'setUserData'.
Open

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Privilege' in method 'checkPermission'.
Open

        \App\Privilege::setPermissionInterpreter("\\Api\\{$namespace}\\Privilege");
Severity: Minor
Found in api/webservice/Core/BaseAction.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 assigning values to variables in if clauses and the like (line '201', column '29').
Open

    public function getParentCrmId(): ?int
    {
        if ($this->controller && ($parentId = $this->controller->request->getHeader('x-parent-id'))) {
            $hierarchy = new \Api\WebservicePremium\BaseModule\Hierarchy();
            $hierarchy->setAllUserData($this->userData);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class '\App\Utils' in method 'setAllUserData'.
Open

        $this->userData = \App\Utils::merge($this->userData, $data);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

                $this->userData['preferences'] = \App\Json::isEmpty($this->userData['preferences']) ? [] : \App\Json::decode($this->userData['preferences']);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 assigning values to variables in if clauses and the like (line '152', column '13').
Open

    public function getLanguage(): string
    {
        $language = '';
        if ($userLang = $this->getUserData('language')) {
            $language = $userLang;
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class '\App\Utils' in method 'updateUser'.
Open

            $data['auth'] = \App\Encryption::getInstance()->encrypt(\App\Json::encode(\App\Utils::merge(($this->getUserData('auth') ?? []), $data['auth'])));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Language' in method 'preProcess'.
Open

            \App\Language::setTemporaryLanguage($language);
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Config' in method 'getLanguage'.
Open

            $language = \App\Config::main('default_language');
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'Api\Core\Module' in method 'checkPermissionToModule'.
Open

        if (!$this->controller->request->isEmpty('module') && !Module::checkModuleAccess($this->controller->request->get('module'))) {
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

            $this->userData['custom_params'] = \App\Json::isEmpty($this->userData['custom_params']) ? [] : \App\Json::decode($this->userData['custom_params']);
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Utils' in method 'setUserData'.
Open

            $this->userData[$key] = \App\Utils::merge($this->userData[$key], $value);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'getUserData'.
Open

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'getUserData'.
Open

                $this->userData[$key] = empty($this->userData['auth']) ? [] : \App\Json::decode(\App\Encryption::getInstance()->decrypt($this->userData['auth']));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\TextUtils' in method 'updateUser'.
Open

        $this->userData['custom_params']['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Utils' in method 'updateUser'.
Open

            $data['preferences'] = \App\Json::encode(\App\Utils::merge($this->userData['preferences'], $data['preferences']));
Severity: Minor
Found in api/webservice/Core/BaseAction.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 getLanguage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $language = \App\Config::main('default_language');
        }
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

            $data['custom_params'] = \App\Json::encode(\App\Utils::merge($this->userData['custom_params'], $data['custom_params']));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Language' in method 'preProcess'.
Open

            \App\Language::initLocale();
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'loadSession'.
Open

            ->one(\App\Db::getInstance('webservice'));
Severity: Minor
Found in api/webservice/Core/BaseAction.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\TextUtils' in method 'updateSession'.
Open

        $data['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);
Severity: Minor
Found in api/webservice/Core/BaseAction.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 'updateUser'.
Open

                $this->userData['preferences'] = \App\Json::isEmpty($this->userData['preferences']) ? [] : \App\Json::decode($this->userData['preferences']);
Severity: Minor
Found in api/webservice/Core/BaseAction.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\Config' in method 'preProcess'.
Open

        if (\App\Config::performance('CHANGE_LOCALE')) {
Severity: Minor
Found in api/webservice/Core/BaseAction.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 "tables" 5 times.
Open

        $sessionTable = $this->controller->app['tables']['session'];
Severity: Critical
Found in api/webservice/Core/BaseAction.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 "session" 3 times.
Open

        $sessionTable = $this->controller->app['tables']['session'];
Severity: Critical
Found in api/webservice/Core/BaseAction.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 "x-token" 3 times.
Open

        if (empty($this->controller->headers['x-token'])) {
Severity: Critical
Found in api/webservice/Core/BaseAction.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 "custom_params" 12 times.
Open

        } elseif ($userLang = $this->getUserData('custom_params', 'language')) {
Severity: Critical
Found in api/webservice/Core/BaseAction.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.

Rename "$userData" which has the same name as the field declared at line 32.
Open

        $userData = (new \App\Db\Query())->select(["$userTable.*", 'sid' => "$sessionTable.id", "$sessionTable.language", "$sessionTable.created", "$sessionTable.changed", "$sessionTable.params"])

Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

Noncompliant Code Example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0;
    ...
  }
}

See

Define a constant instead of duplicating this literal "webservice" 4 times.
Open

            ->one(\App\Db::getInstance('webservice'));
Severity: Critical
Found in api/webservice/Core/BaseAction.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 "preferences" 10 times.
Open

        if ('custom_params' === $key || 'preferences' === $key) {
Severity: Critical
Found in api/webservice/Core/BaseAction.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 method setCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

        \App\User::setCurrentUserId($this->getUserData('user_id'));
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

Doc-block of getUserStorageId has declared return type int which is not a permitted replacement of the nullable return type ?int declared in the signature ('?T' should be documented as 'T|null' or '?T')
Open

     * @return int
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phan

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

        $userData = (new \App\Db\Query())->select(["$userTable.*", 'sid' => "$sessionTable.id", "$sessionTable.language", "$sessionTable.created", "$sessionTable.changed", "$sessionTable.params"])
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

Call to method getInstance from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
Open

            $data['auth'] = \App\Encryption::getInstance()->encrypt(\App\Json::encode(\App\Utils::merge(($this->getUserData('auth') ?? []), $data['auth'])));
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

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

        $userModel = \App\User::getCurrentUserModel();
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

Argument 1 (text) is bool but \App\TextUtils::textTruncate() takes string defined at /code/app/TextUtils.php:40
Open

        $this->userData['custom_params']['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phan

Returning type string but getParentCrmId() is declared to return int|null
Open

                return $parentId;
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phan

Argument 1 (text) is bool but \App\TextUtils::textTruncate() takes string defined at /code/app/TextUtils.php:40
Open

        $data['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phan

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

        \App\Db::getInstance('webservice')->createCommand()
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

Call to method getInstance from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
Open

                $this->userData[$key] = empty($this->userData['auth']) ? [] : \App\Json::decode(\App\Encryption::getInstance()->decrypt($this->userData['auth']));
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

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

            \App\Db::getInstance('webservice')->createCommand()
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

Assigning string to property but \Api\WebservicePremium\BaseModule\Hierarchy->findId is bool|false|int
Open

            $hierarchy->findId = $parentId;
Severity: Minor
Found in api/webservice/Core/BaseAction.php by phan

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

        \App\Db::getInstance('webservice')->createCommand()
Severity: Critical
Found in api/webservice/Core/BaseAction.php by phan

This branch's code block is the same as the block for the branch on line 150.
Open

        } elseif ($userLang = $this->getUserData('custom_params', 'language')) {
            $language = $userLang;
        } elseif (!empty($this->controller->headers['accept-language'])) {

Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if chain they should be combined, or for a switch, one should fall through to the other.

Noncompliant Code Example

switch ($i) {
  case 1:
    doSomething();
    break;
  case 2:
    doSomethingDifferent();
    break;
  case 3:  // Noncompliant; duplicates case 1's implementation
    doSomething();
    break;
  default:
    doTheRest();
}

if ($a >= 0 && $a < 10) {
  doTheThing();
else if ($a >= 10 && $a < 20) {
  doTheOtherThing();
}
else if ($a >= 20 && $a < 50) {
  doTheThing();  // Noncompliant; duplicates first condition
}
else {
  doTheRest();
}

if ($b == 0) {
  doOneMoreThing();
}
else {
  doOneMoreThing(); // Noncompliant; duplicates then-branch
}

var b = a ? 12 > 4 : 4;  // Noncompliant; always results in the same value

Compliant Solution

switch ($i) {
  case 1:
  case 3:
    doSomething();
    break;
  case 2:
    doSomethingDifferent();
    break;
  default:
    doTheRest();
}

if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) {
  doTheThing();
else if ($a >= 10 && $a < 20) {
  doTheOtherThing();
}
else {
  doTheRest();
}

doOneMoreThing();

b = 4;

or

switch ($i) {
  case 1:
    doSomething();
    break;
  case 2:
    doSomethingDifferent();
    break;
  case 3:
    doThirdThing();
    break;
  default:
    doTheRest();
}

if ($a >= 0 && $a < 10) {
  doTheThing();
else if ($a >= 10 && $a < 20) {
  doTheOtherThing();
}
else if ($a >= 20 && $a < 50) {
  doTheThirdThing();
}
else {
  doTheRest();
}

if ($b == 0) {
  doOneMoreThing();
}
else {
  doTheRest();
}

int b = a ? 12 > 4 : 8;

Exceptions

Blocks in an if chain that contain a single line of code are ignored, as are blocks in a switch statement that contain a single line of code with or without a following break.

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

    public $allowedMethod;

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

    /** @var \Api\Controller */

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

    /** @var array User data */

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

    /** @var string Response data 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

    public $allowedHeaders = [];

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

    private $userData = [];

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

     * @throws \Api\Core\Exception

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

Line exceeds 120 characters; contains 134 characters
Open

        if (!$this->controller->request->isEmpty('module') && !Module::checkModuleAccess($this->controller->request->get('module'))) {

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

    }

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

            $language = \App\Config::main('default_language');

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

    }

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

     * @return int

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

    /** @var array Allowed headers */

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

    public $responseType = 'data';

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

     * Check permission to module.

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

     * @throws \Api\Core\Exception

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

        \App\Privilege::setPermissionInterpreter("\\Api\\{$namespace}\\Privilege");

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

    /**

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

    {

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

        $userModel->set('permission_crmid', $this->getUserCrmId());

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

        $this->updateSession();

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

    {

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

            ->from($userTable)

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

            ->where(["$sessionTable.id" => $this->controller->headers['x-token'], "$userTable.status" => 1])

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

     *

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

        }

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

    /**

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

     * @return string

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

        } elseif ($userLang = $this->getUserData('custom_params', 'language')) {

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

     * Get user storage ID.

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

    public function getUserStorageId(): ?int

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

        if ((isset($this->allowedMethod) && !\in_array($this->controller->method, $this->allowedMethod)) || !method_exists($this, $this->controller->method)) {

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

        }

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

     * @throws \Api\Core\Exception

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

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

    /**

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

     * @return int

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

     *

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

    /** @var string[] Allowed methods */

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

    protected function checkPermission(): void

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

            throw new \Api\Core\Exception('No sent token', 401);

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

        $sessionTable = $this->controller->app['tables']['session'];

Line exceeds 120 characters; contains 196 characters
Open

        $userData = (new \App\Db\Query())->select(["$userTable.*", 'sid' => "$sessionTable.id", "$sessionTable.language", "$sessionTable.created", "$sessionTable.changed", "$sessionTable.params"])

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

        return $language;

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

    {

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

    }

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

        $userModel->set('permission_app', $this->controller->app['id']);

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

        $namespace = $this->controller->app['type'];

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

     * Load user session data .

Line exceeds 120 characters; contains 247 characters
Open

        if ((strtotime('now') > strtotime($this->getUserData('created')) + (\Config\Security::$apiLifetimeSessionCreate * 60)) || (strtotime('now') > strtotime($this->getUserData('changed')) + (\Config\Security::$apiLifetimeSessionUpdate * 60))) {

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 getLanguage(): string

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

            $language = str_replace('_', '-', \Locale::acceptFromHttp($this->controller->headers['accept-language']));

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->userData['crmid'] ?: 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

    public $controller;

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

            throw new \Api\Core\Exception('Invalid method', 405);

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

            throw new \Api\Core\Exception('No permissions for module', 403);

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

     * @throws \Api\Core\Exception

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

        $userData = (new \App\Db\Query())->select(["$userTable.*", 'sid' => "$sessionTable.id", "$sessionTable.language", "$sessionTable.created", "$sessionTable.changed", "$sessionTable.params"])

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

            throw new \Api\Core\Exception('Invalid token', 401);

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

    protected function checkLifetimeSession(): void

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

        } else {

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

    /**

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

     * Check permission to method.

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

        if (!$userData) {

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

        if ((strtotime('now') > strtotime($this->getUserData('created')) + (\Config\Security::$apiLifetimeSessionCreate * 60)) || (strtotime('now') > strtotime($this->getUserData('changed')) + (\Config\Security::$apiLifetimeSessionUpdate * 60))) {

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

    public function preProcess()

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

        }

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

            $language = $userLang;

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\PrivilegeQuery::setPermissionInterpreter("\\Api\\{$namespace}\\PrivilegeQuery");

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 (int) $this->userData['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

        $this->checkPermissionToModule();

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

        $this->loadSession();

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

     */

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

     * Get current language.

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

        if ($userLang = $this->getUserData('language')) {

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

            $language = $userLang;

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

     * Get crmid for portal user.

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

     * Get parent record.

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

     * Check called action.

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

        $this->checkLifetimeSession();

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

    public function checkAction(): void

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

        $userModel->set('permission_type', $this->getPermissionType());

Line exceeds 120 characters; contains 159 characters
Open

        if ((isset($this->allowedMethod) && !\in_array($this->controller->method, $this->allowedMethod)) || !method_exists($this, $this->controller->method)) {

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

    protected function checkPermissionToModule(): 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

    /**

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

     */

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

        if (empty($this->controller->headers['x-token'])) {

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

            ->innerJoin($sessionTable, "$sessionTable.user_id = $userTable.id")

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

     *

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

        $language = '';

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

     * Check lifetime user session.

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

        } elseif (!empty($this->controller->headers['accept-language'])) {

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

    public function getPermissionType(): int

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

        if (\App\Config::performance('CHANGE_LOCALE')) {

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

            \App\Language::initLocale();

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->userData['istorage'] ?? null;

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

     * @throws \Api\Core\Exception

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

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

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

                ->delete($this->controller->app['tables']['session'], ['id' => $this->controller->headers['x-token']])

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

            throw new \Api\Core\Exception('Token has expired', 401);

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 (!$this->controller->request->isEmpty('module') && !Module::checkModuleAccess($this->controller->request->get('module'))) {

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

        \App\User::setCurrentUserId($this->getUserData('user_id'));

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

    protected function loadSession(): void

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

        $userTable = $this->controller->app['tables']['user'];

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

            ->one(\App\Db::getInstance('webservice'));

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

        $this->setAllUserData($userData);

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

        $language = $this->getLanguage();

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

     */

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

    /**

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

     * @return void

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

     *

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\Language::setTemporaryLanguage($language);

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

        $userModel = \App\User::getCurrentUserModel();

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

     *

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

     * Pre process function.

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

    {

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

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

     */

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

    /**

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

     *

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

     * @param array $data

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 ('custom_params' === $key || 'preferences' === $key) {

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

            if (!\is_array($this->userData[$key])) {

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

        $this->userData['custom_params']['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);

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

            $data['custom_params'] = \App\Json::encode(\App\Utils::merge($this->userData['custom_params'], $data['custom_params']));

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

            if (!\is_array($this->userData['preferences'])) {

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($this->controller->app['tables']['user'], $data, ['id' => $this->userData['id']])

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

     *

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

            $parentRecord = \App\Record::getParentRecord($this->getUserCrmId());

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

    }

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

     * @param string $key

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

            $this->userData[$key] = \App\Utils::merge($this->userData[$key], $value);

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

            }

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

     * @param array $data

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

            ->update($this->controller->app['tables']['session'], $data, ['id' => $this->userData['sid']])

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

        if (isset($data['auth'])) {

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

            if (isset($records[$parentId])) {

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

            throw new \Api\Core\Exception('No permission to X-PARENT-ID', 403);

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

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

        $data['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);

Line exceeds 120 characters; contains 159 characters
Open

            $this->userData['custom_params'] = \App\Json::isEmpty($this->userData['custom_params']) ? [] : \App\Json::decode($this->userData['custom_params']);

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

    public function setAllUserData(array $data): void

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

            if (!\is_array($this->userData[$key])) {

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

            $data['auth'] = \App\Encryption::getInstance()->encrypt(\App\Json::encode(\App\Utils::merge(($this->getUserData('auth') ?? []), $data['auth'])));

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

        if (isset($data['preferences'])) {

Line exceeds 120 characters; contains 126 characters
Open

            $data['preferences'] = \App\Json::encode(\App\Utils::merge($this->userData['preferences'], $data['preferences']));

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

                return $parentId;

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

    public function setUserData(string $key, $value): void

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

     * Get user data and session data.

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->userData[$key] ?? null;

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

     *

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

        $data['ip'] = $this->controller->request->getServer('REMOTE_ADDR');

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

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

     *

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

Line exceeds 120 characters; contains 130 characters
Open

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);

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

     * @return void

Line exceeds 120 characters; contains 157 characters
Open

                $this->userData['preferences'] = \App\Json::isEmpty($this->userData['preferences']) ? [] : \App\Json::decode($this->userData['preferences']);

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

     * @return int|null

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

            $records = $hierarchy->get();

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

            }

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

    }

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

     * @param mixed  $value

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 (!isset($this->userData[$key])) {

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

            return;

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

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

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

            $data['preferences'] = \App\Json::encode(\App\Utils::merge($this->userData['preferences'], $data['preferences']));

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

            $hierarchy->moduleName = $parentRecord ? '' : \App\Record::getType($parentRecord);

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

        if ('custom_params' === $key || 'preferences' === $key) {

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

        $data['parent_id'] = $this->controller->request->getHeader('x-parent-id') ?: 0;

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

     *

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

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);

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

        } elseif ('auth' === $key) {

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

    {

Line exceeds 120 characters; contains 129 characters
Open

        $data['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, false);

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

    /**

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

            }

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

            }

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

    public function updateSession(array $data = []): void

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

     * Update user data.

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

     * @param array $data

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

            $hierarchy = new \Api\WebservicePremium\BaseModule\Hierarchy();

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

        return \App\Record::getParentRecord($this->getUserCrmId());

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

     * Set user data.

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

     * Set user data.

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

     * @return void

Line exceeds 120 characters; contains 162 characters
Open

                $this->userData[$key] = empty($this->userData['auth']) ? [] : \App\Json::decode(\App\Encryption::getInstance()->decrypt($this->userData['auth']));

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

            $hierarchy->setAllUserData($this->userData);

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

            $hierarchy->findId = $parentId;

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

        $this->userData = \App\Utils::merge($this->userData, $data);

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->userData[$key] = $value;

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 updateUser(array $data = []): 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

                $this->userData['preferences'] = \App\Json::isEmpty($this->userData['preferences']) ? [] : \App\Json::decode($this->userData['preferences']);

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

            if (!\is_array($this->userData[$key])) {

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

     * @param string $key

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

                $this->userData[$key] = empty($this->userData['auth']) ? [] : \App\Json::decode(\App\Encryption::getInstance()->decrypt($this->userData['auth']));

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

     * Update user session.

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

        $data['changed'] = date('Y-m-d H:i:s');

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

        $data['last_method'] = $this->controller->request->getServer('REQUEST_URI');

Line exceeds 120 characters; contains 132 characters
Open

            $data['custom_params'] = \App\Json::encode(\App\Utils::merge($this->userData['custom_params'], $data['custom_params']));

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

        }

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

        } else {

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

     *

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

     */

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->userData[$key][$param] ?? null;

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

    }

Line exceeds 120 characters; contains 156 characters
Open

        $this->userData['custom_params']['agent'] = \App\TextUtils::textTruncate($this->controller->request->getServer('HTTP_USER_AGENT', '-'), 100, 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 void

Line exceeds 120 characters; contains 130 characters
Open

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);

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

     * @return mixed

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

     *

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

     * @return void

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

            $this->userData['custom_params'] = \App\Json::isEmpty($this->userData['custom_params']) ? [] : \App\Json::decode($this->userData['custom_params']);

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

        if (isset($data['custom_params'])) {

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

     * @throws \Api\Core\Exception

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

        if ($this->controller && ($parentId = $this->controller->request->getHeader('x-parent-id'))) {

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

     *

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

                $this->userData[$key] = \App\Json::isEmpty($this->userData[$key]) ? [] : \App\Json::decode($this->userData[$key]);

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

    /**

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

     * @param string $param

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

    public function getUserData(string $key, string $param = '')

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

            }

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

        if (empty($this->userData['sid'])) {

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

        if (!\is_array($this->userData['custom_params'])) {

Line exceeds 120 characters; contains 157 characters
Open

            $data['auth'] = \App\Encryption::getInstance()->encrypt(\App\Json::encode(\App\Utils::merge(($this->getUserData('auth') ?? []), $data['auth'])));

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

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

There are no issues that match your filters.

Category
Status