Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
24 | public function extract( |
||
25 | ExtractionRequest $request, |
||
26 | Extractor $base = null |
||
27 | ): array { |
||
28 | if (!is_iterable($request->value())) { |
||
29 | return $this->next->extract($request, $base); |
||
30 | } |
||
31 | assert($base !== null); |
||
32 | $properties = []; |
||
33 | $count = 0; |
||
34 | foreach ($request->value() as $key => $value) { |
||
35 | $properties[] = $base->extract($request->forCollectionItem( |
||
36 | $request->value(), |
||
37 | (string) $key, |
||
38 | $value |
||
39 | )); |
||
40 | $count++; |
||
41 | } |
||
42 | return these( |
||
43 | [PropertyState::with((string) $request->nameForCounting(), $count)], |
||
44 | ...$properties |
||
45 | ); |
||
48 |