Total Complexity | 6 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | trait ArrayAccessTrait |
||
10 | { |
||
11 | /** |
||
12 | * Determine if the given attribute exists. |
||
13 | * |
||
14 | * @param mixed $offset |
||
15 | * @return bool |
||
16 | */ |
||
17 | 4 | public function offsetExists($offset): bool |
|
20 | } |
||
21 | |||
22 | /** |
||
23 | * Get the value for a given offset. |
||
24 | * |
||
25 | * @param mixed $offset |
||
26 | * @return mixed |
||
27 | */ |
||
28 | 2 | public function offsetGet($offset) |
|
29 | { |
||
30 | 2 | if (!$this->offsetExists($offset)) { |
|
31 | 1 | return null; |
|
32 | } |
||
33 | 2 | return $this->{$offset}; |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * Set the value for a given offset. |
||
38 | * |
||
39 | * @param mixed $offset |
||
40 | * @param mixed $value |
||
41 | * @return void |
||
42 | */ |
||
43 | 2 | public function offsetSet($offset, $value) |
|
46 | 2 | } |
|
47 | |||
48 | /** |
||
49 | * Unset the value for a given offset. |
||
50 | * |
||
51 | * @param mixed $offset |
||
52 | * @return void |
||
53 | */ |
||
54 | 1 | public function offsetUnset($offset) |
|
59 |