| Total Complexity | 11 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Dual implements ICache |
||
| 15 | { |
||
| 16 | protected ICache $storageCache; |
||
| 17 | protected ICache $reloadCache; |
||
| 18 | |||
| 19 | 4 | public function __construct(ICache $storageCache, ?ICache $reloadCache = null) |
|
| 20 | { |
||
| 21 | 4 | $this->storageCache = $storageCache; |
|
| 22 | 4 | $this->reloadCache = $reloadCache ?: $storageCache; |
|
| 23 | 4 | } |
|
| 24 | |||
| 25 | 2 | public function init(array $what): void |
|
| 26 | { |
||
| 27 | 2 | $this->storageCache->init($what); |
|
| 28 | 2 | $this->reloadCache->init($what); |
|
| 29 | 2 | } |
|
| 30 | |||
| 31 | 2 | public function exists(): bool |
|
| 32 | { |
||
| 33 | 2 | return $this->storageCache->exists() && !$this->reloadCache->exists(); |
|
| 34 | } |
||
| 35 | |||
| 36 | 3 | public function set(string $content): bool |
|
| 47 | } |
||
| 48 | |||
| 49 | 2 | public function get(): string |
|
| 52 | } |
||
| 53 | |||
| 54 | 1 | public function clear(): void |
|
| 57 | 1 | } |
|
| 58 | } |
||
| 59 |