1 | <?php |
||
57 | trait ApparatObjectTrait |
||
58 | { |
||
59 | /** |
||
60 | * Property mapping |
||
61 | * |
||
62 | * @var array |
||
63 | */ |
||
64 | protected $mapping = []; |
||
65 | |||
66 | /** |
||
67 | * Generic getter |
||
68 | * |
||
69 | * @param string $method Method name |
||
70 | * @param array $arguments Arguments |
||
71 | * @return mixed Object property value |
||
72 | * @throws \BadMethodCallException If the method is unknown |
||
73 | */ |
||
74 | 2 | public function __call($method, array $arguments) |
|
89 | |||
90 | /** |
||
91 | * Delegate the mapped object getter |
||
92 | * |
||
93 | * @param string $property Property name |
||
94 | * @param string $getter Getter name |
||
95 | * @param array $arguments Getter arguments |
||
96 | * @return mixed Property value |
||
97 | * @throws InvalidArgumentException If the property is invalid |
||
98 | */ |
||
99 | 3 | protected function delegateObjectGetter($property, $getter, array $arguments) |
|
114 | |||
115 | /** |
||
116 | * Return whether a particular property exists |
||
117 | * |
||
118 | * @param string $offset Property name |
||
119 | * @return boolean Property exists |
||
120 | */ |
||
121 | 1 | public function offsetExists($offset) |
|
125 | |||
126 | /** |
||
127 | * Return a particular property |
||
128 | * |
||
129 | * @param string $offset Property name |
||
130 | * @return mixed Property value |
||
131 | * @throws InvalidArgumentException If the requested property is invalid |
||
132 | */ |
||
133 | 4 | public function offsetGet($offset) |
|
148 | |||
149 | /** |
||
150 | * Set a particular property |
||
151 | * |
||
152 | * @param string $offset Property name |
||
153 | * @param mixed $value Property value |
||
154 | * @throws InvalidArgumentException |
||
155 | */ |
||
156 | 1 | public function offsetSet($offset, $value) |
|
163 | |||
164 | /** |
||
165 | * Unset a particular property |
||
166 | * |
||
167 | * @param string $offset Property name |
||
168 | * @throws InvalidArgumentException |
||
169 | */ |
||
170 | 1 | public function offsetUnset($offset) |
|
177 | |||
178 | /** |
||
179 | * Append a value |
||
180 | * |
||
181 | * @param mixed $value Value |
||
182 | * @throws InvalidArgumentException |
||
183 | */ |
||
184 | 1 | public function append($value) |
|
191 | |||
192 | /** |
||
193 | * Return an array copy of all object properties |
||
194 | * |
||
195 | * @return array Object properties |
||
196 | */ |
||
197 | 1 | public function getArrayCopy() |
|
210 | |||
211 | /** |
||
212 | * Return the number of object properties |
||
213 | * |
||
214 | * @return int Number of object properties |
||
215 | */ |
||
216 | 1 | public function count() |
|
220 | |||
221 | /** |
||
222 | * Sort the object properties by value |
||
223 | * |
||
224 | * @return void |
||
225 | */ |
||
226 | 1 | public function asort() |
|
230 | |||
231 | /** |
||
232 | * Sort the entries by key |
||
233 | * @link http://php.net/manual/en/arrayobject.ksort.php |
||
234 | * @return void |
||
235 | * @since 5.2.0 |
||
236 | */ |
||
237 | /** |
||
238 | * Sort the object properties by key |
||
239 | * |
||
240 | * @return void |
||
241 | */ |
||
242 | 1 | public function ksort() |
|
246 | |||
247 | /** |
||
248 | * Sort the object properties by user function |
||
249 | * |
||
250 | * @param \Closure|\Callable $compareFunction User function |
||
251 | * @return void |
||
252 | */ |
||
253 | 1 | public function uasort($compareFunction) |
|
260 | |||
261 | /** |
||
262 | * Sort the object properties by name and user function |
||
263 | * |
||
264 | * @param \Closure|\Callable $compareFunction User function |
||
265 | * @return void |
||
266 | */ |
||
267 | 1 | public function uksort($compareFunction) |
|
274 | |||
275 | /** |
||
276 | * Sort the object properties using a "natural order" algorithm |
||
277 | * |
||
278 | * @return void |
||
279 | */ |
||
280 | 1 | public function natsort() |
|
284 | |||
285 | /** |
||
286 | * Sort the object properties using a case insensitive "natural order" algorithm |
||
287 | * |
||
288 | * @return void |
||
289 | */ |
||
290 | 1 | public function natcasesort() |
|
294 | |||
295 | /** |
||
296 | * Unserialize the apparat object |
||
297 | * |
||
298 | * @param string $serialized Serialized apparat object |
||
299 | */ |
||
300 | 1 | public function unserialize($serialized) |
|
305 | |||
306 | /** |
||
307 | * Exchange the associated object |
||
308 | * |
||
309 | * @param mixed $object Object |
||
310 | * @return ObjectInterface Former object |
||
311 | */ |
||
312 | 1 | public function exchangeArray($object) |
|
326 | |||
327 | /** |
||
328 | * Serialize the apparat object |
||
329 | * |
||
330 | * @return AbstractApparatObject Serialized apparat object |
||
331 | */ |
||
332 | 1 | public function serialize() |
|
336 | |||
337 | /** |
||
338 | * Create and return a new object iterator instance |
||
339 | * |
||
340 | * @return ApparatObjectIterator Object iterator instance |
||
341 | */ |
||
342 | 1 | public function getIterator() |
|
346 | } |
||
347 |