| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public static function toArray(\Iterator $group) |
||
| 21 | { |
||
| 22 | $dump = array(); |
||
| 23 | $accessor = PropertyAccess::createPropertyAccessor(); |
||
| 24 | |||
| 25 | foreach ($group as $entry) { |
||
| 26 | $values = array_values($entry->getGroup()->getKeys()); |
||
| 27 | $keys = sprintf('[%s]', implode('][', $values)); |
||
| 28 | |||
| 29 | if($entry instanceof \Iterator) { |
||
| 30 | $entry = FlatDumper::toArray($entry); |
||
| 31 | } |
||
| 32 | else if($entry instanceof Aggregate) { |
||
| 33 | $entry = $entry->getData(); |
||
| 34 | } |
||
| 35 | |||
| 36 | $accessor->setValue($dump, $keys, $entry); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $dump; |
||
| 40 | } |
||
| 41 | } |