Total Complexity | 7 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
15 | class Formatted |
||
16 | { |
||
17 | protected Interfaces\ICache $cache; |
||
18 | protected Interfaces\IFormat $format; |
||
19 | |||
20 | 1 | public function __construct(Interfaces\ICache $cache, Interfaces\IFormat $format) |
|
21 | { |
||
22 | 1 | $this->cache = $cache; |
|
23 | 1 | $this->format = $format; |
|
24 | 1 | } |
|
25 | |||
26 | /** |
||
27 | * @param string[] $what |
||
28 | * @throws CacheException |
||
29 | */ |
||
30 | 1 | public function init(array $what): void |
|
31 | { |
||
32 | 1 | $this->cache->init($what); |
|
33 | 1 | } |
|
34 | |||
35 | /** |
||
36 | * @throws CacheException |
||
37 | * @return bool |
||
38 | */ |
||
39 | 1 | public function exists(): bool |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param mixed $content |
||
46 | * @throws CacheException |
||
47 | * @return bool |
||
48 | */ |
||
49 | 1 | public function set($content): bool |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * @throws CacheException |
||
56 | * @return mixed |
||
57 | */ |
||
58 | 1 | public function get() |
|
59 | { |
||
60 | 1 | return $this->exists() ? $this->format->unpack($this->cache->get()) : null; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @throws CacheException |
||
65 | */ |
||
66 | 1 | public function clear(): void |
|
69 | 1 | } |
|
70 | } |
||
71 |