YetiForceCompany/YetiForceCRM

View on GitHub
app/Cache/Base.php

Summary

Maintainability
A
0 mins
Test Coverage
B
86%

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

    public function save($key, $value = null, $duration = false)
Severity: Minor
Found in app/Cache/Base.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Returning type false but get() is declared to return array|string
Open

        return self::$cache[$key] ?? false;
Severity: Minor
Found in app/Cache/Base.php by phan

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

    public function delete($key)
Severity: Minor
Found in app/Cache/Base.php by phan

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

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

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

    private static $cache = [];
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

     * Is apcu is available.
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

     * @return array|string
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

    public function get($key)
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

    /**
Severity: Minor
Found in app/Cache/Base.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/Base.php by phpcodesniffer

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

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

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

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

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

    public function save($key, $value = null, $duration = false)
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

        return self::$cache[$key] ?? false;
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self::$cache = [];
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

     *
Severity: Minor
Found in app/Cache/Base.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/Base.php by phpcodesniffer

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

        self::$cache[$key] = $value;
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

     * @return bool
Severity: Minor
Found in app/Cache/Base.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/Base.php by phpcodesniffer

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

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

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

    public function has($key)
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

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

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

        unset(self::$cache[$key]);
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

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

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

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

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

     * @param array|string|null $value    Data to store
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

    public function delete($key)
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

    }
Severity: Minor
Found in app/Cache/Base.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/Base.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return isset(self::$cache[$key]);
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

        unset($duration);
Severity: Minor
Found in app/Cache/Base.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

     *
Severity: Minor
Found in app/Cache/Base.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/Base.php by phpcodesniffer

There are no issues that match your filters.

Category
Status