YetiForceCompany/YetiForceCRM

View on GitHub
app/Cache.php

Summary

Maintainability
A
2 hrs
Test Coverage
B
80%

The class Cache has 14 public methods. Consider refactoring Cache to keep number of public methods under 10.
Open

class Cache
{
    /** @var int Long time data storage */
    const LONG = 3600;

Severity: Minor
Found in app/Cache.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

Function clearTemporaryFiles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function clearTemporaryFiles(string $days = '-30 day'): array
    {
        $time = strtotime($days);
        $exclusion = ['.htaccess', 'index.html'];
        $s = $i = 0;
Severity: Minor
Found in app/Cache.php - About 2 hrs 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 clearTemporaryFiles() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
Open

    public static function clearTemporaryFiles(string $days = '-30 day'): array
    {
        $time = strtotime($days);
        $exclusion = ['.htaccess', 'index.html'];
        $s = $i = 0;
Severity: Minor
Found in app/Cache.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 static function clearTemporaryFiles(string $days = '-30 day'): array
Severity: Critical
Found in app/Cache.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

Missing class import via use statement (line '267', column '18').
Open

            foreach ((new \DirectoryIterator($dir)) as $item) {
Severity: Minor
Found in app/Cache.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 '258', column '17').
Open

            foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ROOT_DIRECTORY . "/cache/{$dir}", \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Cache.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 '258', column '48').
Open

            foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ROOT_DIRECTORY . "/cache/{$dir}", \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Cache.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 '43', column '29').
Open

        static::$staticPool = new \App\Cache\Base();
Severity: Minor
Found in app/Cache.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\Fields\File' in method 'clearTemporaryFiles'.
Open

        foreach ([ROOT_DIRECTORY . '/cache', \App\Fields\File::getTmpPath()] as $dir) {
Severity: Minor
Found in app/Cache.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'App\Log' in method 'save'.
Open

            Log::warning("Error writing to cache. Key: $nameSpace-$key | Value: " . var_export($value, true));
Severity: Minor
Found in app/Cache.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 'init'.
Open

        $driver = \App\Config::performance('CACHING_DRIVER');
Severity: Minor
Found in app/Cache.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Log' in method 'clearOpcache'.
Open

                \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
Severity: Minor
Found in app/Cache.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

Doc-block of $nameSpace in get contains phpdoc param type mixed which is incompatible with the param type string declared in the signature
Open

     * @param mixed  $nameSpace
Severity: Minor
Found in app/Cache.php by phan

Expected @param annotation for nameSpace to be before the @param annotation for key
Open

     * @param string $key       Cache ID
Severity: Info
Found in app/Cache.php by phan

Expected @param annotation for nameSpace to be before the @param annotation for key
Open

     * @param string $key       Cache ID
Severity: Info
Found in app/Cache.php by phan

Method \App\Cache::staticDelete is declared to return bool but has no return value
Open

    public static function staticDelete(string $nameSpace, string $key)
Severity: Minor
Found in app/Cache.php by phan

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

                \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
Severity: Critical
Found in app/Cache.php by phan

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

            Log::warning("Error writing to cache. Key: $nameSpace-$key | Value: " . var_export($value, true));
Severity: Critical
Found in app/Cache.php by phan

Doc-block of $nameSpace in delete contains phpdoc param type mixed which is incompatible with the param type string declared in the signature
Open

     * @param mixed  $nameSpace
Severity: Minor
Found in app/Cache.php by phan

Saw an @param annotation for duration, but it was not found in the param list of function staticSave(string $nameSpace, string $key, mixed $value = null) : bool
Open

     * @param int    $duration  Cache TTL (in seconds)
Severity: Info
Found in app/Cache.php by phan

Expected @param annotation for nameSpace to be before the @param annotation for key
Open

     * @param string $key       Cache ID
Severity: Info
Found in app/Cache.php by phan

Method \App\Cache::delete is declared to return bool but has no return value
Open

    public static function delete(string $nameSpace, string $key)
Severity: Minor
Found in app/Cache.php by phan

Doc-block of $nameSpace in save contains phpdoc param type mixed which is incompatible with the param type string declared in the signature
Open

     * @param mixed  $nameSpace
Severity: Minor
Found in app/Cache.php by phan

Method \App\Cache::staticClear is declared to return bool but has no return value
Open

    public static function staticClear()
Severity: Minor
Found in app/Cache.php by phan

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

        $s = $i = 0;
Severity: Minor
Found in app/Cache.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

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

        $s = $i = 0;
Severity: Minor
Found in app/Cache.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

    public static $staticPool;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    /** @var int Long time data storage */
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

     * Clear the opcache after the script finishes.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        if (static::$clearOpcache) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    /** @var int Short time data storage */
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        static::$staticPool->delete("$nameSpace-$key");
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static $clearOpcache = false;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * Confirms if the cache contains specified cache item.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * @param mixed  $value     Data to store, supports string, array, objects
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @param int    $duration  Cache TTL (in seconds)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static function staticDelete(string $nameSpace, string $key)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * Deletes all items in the static cache.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

                static::resetOpcache();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

                \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * Reset opcache if it is possible.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @return void
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

    const LONG = 3600;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @var bool
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        return static::$pool->has("$nameSpace-$key");
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

    public static function clear(): bool
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

    public static function staticSave(string $nameSpace, string $key, $value = null)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * Initialize cache class.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

        if (!static::$pool->save("$nameSpace-$key", $value, $duration)) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

    public static function delete(string $nameSpace, string $key)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

    public static function resetOpcache(): void
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    const SHORT = 60;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        static::$staticPool = new \App\Cache\Base();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

            Log::warning("Error writing to cache. Key: $nameSpace-$key | Value: " . var_export($value, true));
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

    public static $pool;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        $driver = \App\Config::performance('CACHING_DRIVER');
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static function get(string $nameSpace, string $key)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        return $value;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Deletes all items in the cache.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

    const MEDIUM = 300;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * @param mixed  $nameSpace
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * Removes the item from the cache.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Confirms if the static cache contains specified cache item.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Static cache save.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

    public static function staticClear()
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        return static::$clearOpcache = true;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @param mixed  $nameSpace
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * @param int    $duration  Cache TTL (in seconds)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

    public static function clearOpcache(): bool
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    /** @var int Medium time data storage */
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

        return static::$staticPool->has("$nameSpace-$key");
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * Removes the item from the static cache.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

        if (\function_exists('opcache_reset')) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Clean the opcache after the script finishes.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static function init()
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

            static::$pool = new $className();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

    public static function save(string $nameSpace, string $key, $value = null, $duration = self::MEDIUM)
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        static::$pool->delete("$nameSpace-$key");
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static function staticHas(string $nameSpace, string $key = '')
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        });
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

            $className = '\App\Cache\\' . $driver;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static function has(string $nameSpace, string $key): bool
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        return static::$pool->clear();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Returns a static Cache Item representing the specified key.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * @return mixed
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * @param mixed  $value     Data to store
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        return static::$staticPool->save("$nameSpace-$key", $value);
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

        register_shutdown_function(function () {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

        return static::$staticPool->get("$nameSpace-$key");
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @param string $key       Cache ID
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

        static::$pool = static::$staticPool;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Returns a Cache Item representing the specified key.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @return mixed
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        return static::$pool->get("$nameSpace-$key");
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

    public static function staticGet(string $nameSpace, string $key = '')
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

        static::$staticPool->clear();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Clear all cache.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

            if (!file_exists(ROOT_DIRECTORY . "/cache/{$dir}")) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

Line exceeds 120 characters; contains 144 characters
Open

                if ($item->isFile() && !\in_array($item->getBasename(), $exclusion) && $item->getMTime() < $time && $item->getATime() < $time) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

                    unlink($item->getPathname());
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * @param mixed  $nameSpace
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

     * @return int[]
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

    public static function resetFileCache(string $path): void
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

     * Clean old cache files.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        foreach (['pdf', 'import', 'mail', 'vtlib', 'rss_cache', 'upload', 'templates_c'] as $dir) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

                    unlink($item->getPathname());
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

            foreach ((new \DirectoryIterator($dir)) as $item) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

Line exceeds 120 characters; contains 210 characters
Open

            foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ROOT_DIRECTORY . "/cache/{$dir}", \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

                if ($item->isFile() && !\in_array($item->getBasename(), $exclusion) && $item->getMTime() < $time && $item->getATime() < $time) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        foreach ([ROOT_DIRECTORY . '/cache', \App\Fields\File::getTmpPath()] as $dir) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        return ['size' => $s, 'counter' => $i];
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

                    $s += $item->getSize();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

        static::clearOpcache();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        $exclusion = ['.htaccess', 'index.html'];
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

     * @return void
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        static::clear();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        $s = $i = 0;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

            \opcache_reset();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        if (\function_exists('opcache_invalidate')) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

                continue;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

            foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ROOT_DIRECTORY . "/cache/{$dir}", \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

                    ++$i;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

    public static function clearTemporaryFiles(string $days = '-30 day'): array
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

                if ($item->isFile() && 'index.html' !== $item->getBasename() && $item->getMTime() < $time && $item->getATime() < $time) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * Reset file from opcache if it is possible.
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

     * @return void
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

        $time = strtotime($days);
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

                    $s += $item->getSize();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

            \opcache_invalidate($path, true);
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

                    ++$i;
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

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

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

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

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

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

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

    public static function clearAll(): void
Severity: Minor
Found in app/Cache.php by phpcodesniffer

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

        clearstatcache();
Severity: Minor
Found in app/Cache.php by phpcodesniffer

Line exceeds 120 characters; contains 137 characters
Open

                if ($item->isFile() && 'index.html' !== $item->getBasename() && $item->getMTime() < $time && $item->getATime() < $time) {
Severity: Minor
Found in app/Cache.php by phpcodesniffer

There are no issues that match your filters.

Category
Status