Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | trait ArrayAccessTrait |
||
15 | { |
||
16 | /** |
||
17 | * ArrayAccess interface |
||
18 | * |
||
19 | * @param string $key The entry to acces |
||
20 | */ |
||
21 | public function &offsetGet($key) |
||
22 | { |
||
23 | $caller = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]; |
||
24 | |||
25 | $this->stack[] = [ |
||
|
|||
26 | 'entry' => $key, |
||
27 | 'file' => isset($caller['file']) ? $caller['file'] : null, |
||
28 | 'line' => isset($caller['line']) ? $caller['line'] : null, |
||
29 | ]; |
||
30 | |||
31 | return $this; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Unused part of the ArrayAccess interface |
||
36 | * |
||
37 | * @param $offset |
||
38 | * @param $value |
||
39 | * @throws \BadMethodCallException |
||
40 | */ |
||
41 | public function offsetSet($offset, $value) |
||
42 | { |
||
43 | throw new BadMethodCallException( |
||
44 | "not implemented" |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Unused part of the ArrayAccess interface |
||
50 | * |
||
51 | * @param $offset |
||
52 | * @throws \BadMethodCallException |
||
53 | */ |
||
54 | public function offsetExists($offset) |
||
55 | { |
||
56 | throw new BadMethodCallException( |
||
57 | "not implemented" |
||
58 | ); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Unused part of the ArrayAccess interface |
||
63 | * |
||
64 | * @param $offset |
||
65 | * @throws \BadMethodCallException |
||
66 | */ |
||
67 | public function offsetUnset($offset) |
||
71 | ); |
||
72 | } |
||
73 | |||
74 | /**/ |
||
76 |