Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait ArrayAccessible |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | protected $items = []; |
||
11 | |||
12 | /** |
||
13 | * Check if an offset exists |
||
14 | * @param mixed $offset |
||
15 | * @return bool |
||
16 | */ |
||
17 | public function offsetExists($offset): bool |
||
18 | { |
||
19 | return array_key_exists($offset, $this->items); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Offset to retrieve |
||
24 | * @param mixed $offset |
||
25 | * @return mixed |
||
26 | */ |
||
27 | public function offsetGet($offset) |
||
28 | { |
||
29 | return $this->items[$offset]; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Offset to set |
||
34 | * @param mixed $offset |
||
35 | * @param mixed $value |
||
36 | * @return void |
||
37 | */ |
||
38 | public function offsetSet($offset, $value) |
||
39 | { |
||
40 | $this->items[$offset] = $value; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Offset to unset |
||
45 | * @param mixed $offset |
||
46 | * @return void |
||
47 | */ |
||
48 | public function offsetUnset($offset) |
||
51 | } |
||
52 | } |