Total Complexity | 9 |
Total Lines | 85 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
5 | class ProxyService implements \ArrayAccess |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var array |
||
10 | */ |
||
11 | protected $data = []; |
||
12 | |||
13 | /** |
||
14 | * @param string $key |
||
15 | * @return bool |
||
16 | */ |
||
17 | 40 | public function has(string $key): bool |
|
20 | } |
||
21 | |||
22 | /** |
||
23 | * @inheritDoc |
||
24 | */ |
||
25 | 40 | public function offsetExists($offset): bool |
|
26 | { |
||
27 | 40 | return \array_key_exists($offset, $this->data); |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param string $key |
||
32 | * @return int |
||
33 | */ |
||
34 | 30 | public function get(string $key): int |
|
35 | { |
||
36 | 30 | return $this->offsetGet($key); |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * @inheritDoc |
||
41 | */ |
||
42 | 41 | public function offsetGet($offset): int |
|
43 | { |
||
44 | 41 | return $this->data[$offset] ?? 0; |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param string $key |
||
49 | * @param int $value |
||
50 | * @return static |
||
51 | */ |
||
52 | 40 | public function set(string $key, int $value): self |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @inheritDoc |
||
60 | */ |
||
61 | 41 | public function offsetSet($offset, $value): void |
|
64 | 41 | } |
|
65 | |||
66 | /** |
||
67 | * @param string $key |
||
68 | * @return static |
||
69 | */ |
||
70 | 1 | public function remove(string $key): self |
|
71 | { |
||
72 | 1 | $this->offsetUnset($key); |
|
73 | 1 | return $this; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @inheritDoc |
||
78 | */ |
||
79 | 1 | public function offsetUnset($offset): void |
|
80 | { |
||
81 | 1 | unset($this->data[$offset]); |
|
82 | 1 | } |
|
83 | |||
84 | /** |
||
85 | * @return void |
||
86 | */ |
||
87 | 43 | public function fresh(): void |
|
90 | 43 | } |
|
91 | |||
92 | } |
||
93 |