Total Complexity | 4 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | trait AsArrayTrait |
||
11 | { |
||
12 | public function offsetExists($offset): bool |
||
13 | { |
||
14 | $prop = Inflector::camelize($offset); |
||
|
|||
15 | |||
16 | return isset($this->$prop); |
||
17 | } |
||
18 | |||
19 | public function offsetGet($offset) |
||
20 | { |
||
21 | $prop = Inflector::camelize($offset); |
||
22 | |||
23 | return $this->$prop; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @throws BadMethodCallException |
||
28 | */ |
||
29 | public function offsetSet($offset, $value) |
||
30 | { |
||
31 | throw new BadMethodCallException(sprintf('Method "%s" not implemented.', __METHOD__)); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @throws BadMethodCallException |
||
36 | */ |
||
37 | public function offsetUnset($offset) |
||
40 | } |
||
41 | } |
||
42 |