1 | <?php |
||
5 | class Collection extends \ArrayObject |
||
6 | { |
||
7 | 67 | public function __construct($input) |
|
8 | { |
||
9 | 67 | if (is_object($input)) { |
|
10 | 36 | if ($input instanceof \Traversable) { |
|
11 | 3 | $input = iterator_to_array($input); |
|
12 | } else { |
||
13 | 34 | $input = get_object_vars($input); |
|
14 | } |
||
15 | } |
||
16 | 67 | parent::__construct($input, static::ARRAY_AS_PROPS); |
|
17 | 67 | } |
|
18 | |||
19 | /** |
||
20 | * @return \ArrayIterator |
||
21 | */ |
||
22 | 3 | public function getIteratorReversed() |
|
29 | |||
30 | /** |
||
31 | * @return mixed |
||
32 | */ |
||
33 | 11 | public function value() |
|
37 | |||
38 | /** |
||
39 | * @return mixed[] |
||
40 | */ |
||
41 | 53 | public function toArray() |
|
45 | } |
||
46 |