| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class CacheRuntime |
||
| 6 | { |
||
| 7 | protected static $cache = []; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @param string $key |
||
| 11 | * |
||
| 12 | * @return mixed|null |
||
| 13 | */ |
||
| 14 | public static function get(string $key) |
||
| 15 | { |
||
| 16 | return self::$cache[$key] ?? null; |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $key |
||
| 21 | * @param $value |
||
| 22 | */ |
||
| 23 | public static function set(string $key, $value) |
||
| 24 | { |
||
| 25 | self::$cache[$key] = $value; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $key |
||
| 30 | * @param \Closure $closure |
||
| 31 | * |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | public static function getOrSet(string $key, \Closure $closure) |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param string $key |
||
| 44 | */ |
||
| 45 | public static function invalidate(string $key) |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | */ |
||
| 52 | public static function clear() |
||
| 57 |