YetiForceCompany/YetiForceCRM

View on GitHub
app/YetiForce/Config.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '33', column '23').
Open

            $this->data = (new \App\Db\Query())->from(self::TABLE_NAME)->one($db) ?: [];
Severity: Minor
Found in app/YetiForce/Config.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\Cache' in method '__construct'.
Open

                \App\Cache::save(self::CACHE_NAME, '', $this->data, \App\Cache::LONG);
Severity: Minor
Found in app/YetiForce/Config.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\Cache' in method '__construct'.
Open

            $this->data = \App\Cache::get(self::CACHE_NAME, '');
Severity: Minor
Found in app/YetiForce/Config.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\Cache' in method '__construct'.
Open

        if (!\App\Cache::has(self::CACHE_NAME, '')) {
Severity: Minor
Found in app/YetiForce/Config.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\Purifier' in method 'setToken'.
Open

        \App\Purifier::purifyByType($token, \App\Purifier::ALNUM2);
Severity: Minor
Found in app/YetiForce/Config.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 '__construct'.
Open

            $db = \App\Db::getInstance('admin');
Severity: Minor
Found in app/YetiForce/Config.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->data = \App\Cache::get(self::CACHE_NAME, '');
        }
Severity: Minor
Found in app/YetiForce/Config.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\Cache' in method 'setToken'.
Open

            \App\Cache::delete(self::CACHE_NAME, '');
Severity: Minor
Found in app/YetiForce/Config.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

syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)
Open

    private array $data = [];
Severity: Critical
Found in app/YetiForce/Config.php by phan

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

            $db = \App\Db::getInstance('admin');
Severity: Minor
Found in app/YetiForce/Config.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

    /** Constructor */
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

        $result = \App\Db::getInstance('admin')->createCommand()->update(self::TABLE_NAME, ['key' => $token])->execute();
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

    /** @var array Data */
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

    public function getToken(): string
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

            \App\Cache::delete(self::CACHE_NAME, '');
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

    private const CACHE_NAME = 'YetiForce:config';
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

                $result = $db->createCommand()->insert(self::TABLE_NAME, $data)->execute();
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

    public function __construct()
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

                $data = (new Encryption())->getDefaultData();
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

    public function getData(): array
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

                \App\Cache::save(self::CACHE_NAME, '', $this->data, \App\Cache::LONG);
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

        return $this->data;
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

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

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

            $this->data['key'] = $token;
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

    /** @var string URL */
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

    private array $data = [];
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

        return $this->data['key'] ?? '';
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

     * @param string $token
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

    public const TABLE_NAME = 's_#__reg_data';
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

                $this->data = $result ? $data : [];
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

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

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

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

Line exceeds 120 characters; contains 121 characters
Open

        $result = \App\Db::getInstance('admin')->createCommand()->update(self::TABLE_NAME, ['key' => $token])->execute();
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

     * @return array
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

     * @return string
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

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

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

            $this->data = (new \App\Db\Query())->from(self::TABLE_NAME)->one($db) ?: [];
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

    public function setToken(string $token): bool
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

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

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

        if (!\App\Cache::has(self::CACHE_NAME, '')) {
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

     * Get data.
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

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

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

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

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

     * Get token.
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

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

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

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

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

            if (!$this->data) {
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

     * Set Token.
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

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

        \App\Purifier::purifyByType($token, \App\Purifier::ALNUM2);
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

            $this->data = \App\Cache::get(self::CACHE_NAME, '');
Severity: Minor
Found in app/YetiForce/Config.php by phpcodesniffer

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

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

There are no issues that match your filters.

Category
Status