1 | <?php |
||
11 | trait DTOAccessorTrait |
||
12 | { |
||
13 | /** |
||
14 | * Check if offset exists |
||
15 | * @param string $offset |
||
16 | * @return bool |
||
17 | */ |
||
18 | 2 | public function offsetExists($offset) |
|
22 | |||
23 | /** |
||
24 | * Get data at scalar offset or default value instead |
||
25 | * @param string $offset |
||
26 | * @return mixed |
||
27 | * @throws \InvalidArgumentException |
||
28 | */ |
||
29 | 21 | private function offsetGetScalar($offset) |
|
37 | |||
38 | /** |
||
39 | * Get default value at offset if set |
||
40 | * @param string $offset |
||
41 | * @return mixed |
||
42 | * @throws \InvalidArgumentException |
||
43 | */ |
||
44 | 4 | private function getDefaultValue($offset) |
|
52 | |||
53 | /** |
||
54 | * Get data at offset or default value instead |
||
55 | * @param string $offset |
||
56 | * @return mixed |
||
57 | * @throws \InvalidArgumentException |
||
58 | */ |
||
59 | 9 | public function offsetGet($offset) |
|
63 | |||
64 | /** |
||
65 | * Set data at offset |
||
66 | * @param string $offset |
||
67 | * @param mixed $value |
||
68 | */ |
||
69 | 34 | public function offsetSet($offset, $value) |
|
73 | |||
74 | /** |
||
75 | * Remove data at offset |
||
76 | * @param string $offset |
||
77 | */ |
||
78 | 2 | public function offsetUnset($offset) |
|
82 | |||
83 | /** |
||
84 | * Count data elements |
||
85 | * @return int |
||
86 | */ |
||
87 | 2 | public function count() |
|
91 | |||
92 | 5 | public function __get($key) |
|
96 | |||
97 | 2 | public function __set($key, $value) |
|
101 | |||
102 | 2 | public function __isset($key) |
|
106 | } |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.