Conditions | 3 |
Paths | 3 |
Total Lines | 26 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
25 | public function extract( |
||
26 | Name $name, |
||
27 | $collection, |
||
28 | Map $map, |
||
29 | Visited $visited, |
||
30 | Extractor $base = null |
||
31 | ): array { |
||
32 | if (!is_iterable($collection)) { |
||
33 | return $this->next->extract($name, $collection, $map, $visited, $base); |
||
34 | } |
||
35 | assert($base !== null); |
||
36 | $properties = []; |
||
37 | $count = 0; |
||
38 | foreach ($collection as $key => $value) { |
||
39 | $properties[] = $base->extract( |
||
40 | $name->forItem($collection, (string) $key), |
||
41 | $value, |
||
42 | $map, |
||
43 | $visited, |
||
44 | $base |
||
45 | ); |
||
46 | $count++; |
||
47 | } |
||
48 | return these( |
||
49 | [PropertyState::with((string) $name->toCount($collection), $count)], |
||
50 | ...$properties |
||
51 | ); |
||
54 |