| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 33.33% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | trait ArrayAccessTrait |
||
| 19 | { |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Offset to retrieve |
||
| 23 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
| 24 | * @param mixed $offset The offset to retrieve. |
||
| 25 | * |
||
| 26 | * @return mixed Can return all value types. |
||
| 27 | */ |
||
| 28 | public function offsetGet($offset) |
||
| 29 | { |
||
| 30 | return $this->array[$offset] ?? null; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Offset to set |
||
| 35 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
| 36 | * @param mixed $offset The offset to assign the value to. |
||
| 37 | * @param mixed $value The value to set. |
||
| 38 | */ |
||
| 39 | 3 | public function offsetSet($offset, $value) |
|
| 40 | { |
||
| 41 | 3 | $this->array[$offset] = $value; |
|
|
|
|||
| 42 | 3 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Whether a offset exists |
||
| 46 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
| 47 | * |
||
| 48 | * @param mixed $offset |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | public function offsetExists($offset): bool |
||
| 52 | { |
||
| 53 | return isset($this->array[$offset]); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Offset to unset |
||
| 58 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
| 59 | * @param mixed $offset The offset to unset. |
||
| 60 | */ |
||
| 61 | public function offsetUnset($offset) |
||
| 64 | } |
||
| 65 | } |
||
| 66 |