1 | <?php |
||
13 | class CollectionUtils { |
||
14 | |||
15 | /** |
||
16 | * Returns a proper collection for the given array (also transforms nested collections) |
||
17 | * (experimental API) |
||
18 | * |
||
19 | * @param array|Iterator $collection |
||
20 | * @return Map|ArrayList the collection |
||
21 | * @throws InvalidArgumentException |
||
22 | */ |
||
23 | public static function fromCollection($collection) { |
||
30 | |||
31 | private static function toCollection($data) { |
||
50 | |||
51 | /** |
||
52 | * Recursively transforms data into a map (on the first level, deeper levels |
||
53 | * transformed to an appropriate collection) (experimental API) |
||
54 | * |
||
55 | * @param array|Iterator $collection |
||
56 | * @return Map |
||
57 | */ |
||
58 | public static function toMap($collection) { |
||
66 | |||
67 | /** |
||
68 | * Recursively transforms data into a list (on the first level, deeper levels |
||
69 | * transformed to an appropriate collection) (experimental API) |
||
70 | * |
||
71 | * @param array|Iterator $collection |
||
72 | * @return ArrayList |
||
73 | */ |
||
74 | public static function toList($collection) { |
||
81 | |||
82 | /** |
||
83 | * Recursively exports a collection to an array |
||
84 | * |
||
85 | * @param mixed $collection |
||
86 | * @return array |
||
87 | */ |
||
88 | public static function toArrayRecursive($collection) { |
||
101 | |||
102 | } |
||
103 |