| Total Complexity | 9 |
| Total Lines | 85 |
| Duplicated Lines | 0 % |
| Coverage | 72.72% |
| 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 | 39 | public function has(string $key): bool |
|
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @inheritDoc |
||
| 24 | */ |
||
| 25 | 39 | public function offsetExists($offset): bool |
|
| 26 | { |
||
| 27 | 39 | return \array_key_exists($offset, $this->data); |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $key |
||
| 32 | * @return int |
||
| 33 | */ |
||
| 34 | 29 | public function get(string $key): int |
|
| 35 | { |
||
| 36 | 29 | return $this->offsetGet($key); |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritDoc |
||
| 41 | */ |
||
| 42 | 39 | public function offsetGet($offset): int |
|
| 43 | { |
||
| 44 | 39 | return $this->data[$offset] ?? 0; |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $key |
||
| 49 | * @param int $value |
||
| 50 | * @return static |
||
| 51 | */ |
||
| 52 | 39 | public function set(string $key, int $value): self |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @inheritDoc |
||
| 60 | */ |
||
| 61 | 39 | public function offsetSet($offset, $value): void |
|
| 62 | { |
||
| 63 | 39 | $this->data[$offset] = $value; |
|
| 64 | 39 | } |
|
| 65 | |||
| 66 | /** |
||
| 67 | * @param string $key |
||
| 68 | * @return static |
||
| 69 | */ |
||
| 70 | public function remove(string $key): self |
||
| 71 | { |
||
| 72 | $this->offsetUnset($key); |
||
| 73 | return $this; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @inheritDoc |
||
| 78 | */ |
||
| 79 | public function offsetUnset($offset): void |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @return void |
||
| 86 | */ |
||
| 87 | 41 | public function fresh(): void |
|
| 90 | 41 | } |
|
| 91 | |||
| 93 |