| Total Complexity | 11 |
| Total Lines | 100 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class Repository implements \ArrayAccess |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array |
||
| 9 | */ |
||
| 10 | protected $items = []; |
||
| 11 | |||
| 12 | public function __construct(array $items = []) |
||
| 13 | { |
||
| 14 | $this->items = $items; |
||
| 15 | } |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param string $key |
||
| 19 | * @param mixed $value |
||
| 20 | * @return array |
||
| 21 | */ |
||
| 22 | public function set(string $key, $value) : array |
||
| 23 | { |
||
| 24 | $this->items[$key] = $value; |
||
| 25 | |||
| 26 | return $this->items; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param string $key |
||
| 31 | * @param mixed $value |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | public function __set(string $key, $value) : array |
||
| 35 | { |
||
| 36 | return $this->set($key, $value); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return array |
||
| 41 | */ |
||
| 42 | public function all() : array |
||
| 43 | { |
||
| 44 | return $this->items; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string|int $offset |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | public function offsetExists($offset) : bool |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param int|string $offset |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | public function offsetGet($offset) |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param int|string $offset |
||
| 67 | * @param mixed $value |
||
| 68 | * @return void |
||
| 69 | */ |
||
| 70 | public function offsetSet($offset, $value) : void |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param int|string $offset |
||
| 77 | * @return void |
||
| 78 | */ |
||
| 79 | public function offsetUnset($offset) : void |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Return all values except those specified. |
||
| 86 | * |
||
| 87 | * @param string|array $keys |
||
| 88 | * @return array |
||
| 89 | */ |
||
| 90 | public function except($keys) : array |
||
| 107 |