| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 28 | class Json implements ArrayAccess, JsonSerializable |
||
| 29 | { |
||
| 30 | protected array $data; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Constructor of the class |
||
| 34 | */ |
||
| 35 | 3 | public function __construct(array $data) |
|
| 36 | { |
||
| 37 | 3 | $this->data = $data; |
|
| 38 | 3 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * {@inheritdoc} |
||
| 42 | */ |
||
| 43 | 1 | public function offsetExists($offset) : bool |
|
| 44 | { |
||
| 45 | 1 | return array_key_exists($offset, $this->data); |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | 2 | public function offsetGet($offset) |
|
| 52 | { |
||
| 53 | 2 | return $this->data[$offset] ?? null; |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * {@inheritdoc} |
||
| 58 | */ |
||
| 59 | 2 | public function offsetSet($offset, $value) : void |
|
| 60 | { |
||
| 61 | 2 | $this->data[$offset] = $value; |
|
| 62 | 2 | } |
|
| 63 | |||
| 64 | /** |
||
| 65 | * {@inheritdoc} |
||
| 66 | */ |
||
| 67 | 1 | public function offsetUnset($offset) : void |
|
| 70 | 1 | } |
|
| 71 | |||
| 72 | /** |
||
| 73 | * {@inheritdoc} |
||
| 74 | */ |
||
| 75 | 1 | public function jsonSerialize() : array |
|
| 78 | } |
||
| 79 | } |
||
| 80 |