| Total Complexity | 7 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class RequestCache |
||
| 10 | { |
||
| 11 | public string $key; |
||
| 12 | |||
| 13 | public function __construct($key) |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @throws InvalidArgumentException |
||
| 20 | */ |
||
| 21 | private function getRepositoryCacheCollection(): Collection |
||
| 22 | { |
||
| 23 | return Cache::store('array')->get($this->key, collect([])); |
||
|
|
|||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @throws InvalidArgumentException |
||
| 28 | */ |
||
| 29 | public function get($key, $default = null) |
||
| 30 | { |
||
| 31 | return $this->getRepositoryCacheCollection()->get($key, $default); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @throws InvalidArgumentException |
||
| 36 | */ |
||
| 37 | public function set($key, $value): bool |
||
| 38 | { |
||
| 39 | return Cache::store('array')->set( |
||
| 40 | $this->key, |
||
| 41 | $this->getRepositoryCacheCollection()->put($key, $value) |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @throws InvalidArgumentException |
||
| 47 | */ |
||
| 48 | public function delete(array|string|int $key): bool |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @throws InvalidArgumentException |
||
| 58 | */ |
||
| 59 | public function clear(): bool |
||
| 64 | ); |
||
| 65 | } |
||
| 66 | |||
| 67 | public function all(): array |
||
| 70 | } |
||
| 71 | } |
||
| 72 |