| Conditions | 2 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 2 | public function __invoke(): Closure |
|
| 22 | { |
||
| 23 | 2 | $reduceCallback = |
|
| 24 | /** |
||
| 25 | * @param array<int, list<T>> $carry |
||
|
|
|||
| 26 | * @param iterable<TKey, T> $value |
||
| 27 | * |
||
| 28 | * @return array<int, list<T>> |
||
| 29 | */ |
||
| 30 | 2 | static function (array $carry, iterable $value): array { |
|
| 31 | 2 | $index = 0; |
|
| 32 | |||
| 33 | 2 | foreach ($value as $carry[$index++][]); |
|
| 34 | |||
| 35 | 2 | return $carry; |
|
| 36 | 2 | }; |
|
| 37 | |||
| 38 | /** @var Closure(iterable<TKey, list<T>>): Generator<int, list<T>> $pipe */ |
||
| 39 | 2 | $pipe = (new Pipe())()( |
|
| 40 | 2 | (new Reduce())()($reduceCallback)([]), |
|
| 41 | 2 | (new Flatten())()(1) |
|
| 42 | 2 | ); |
|
| 43 | |||
| 44 | // Point free style. |
||
| 45 | 2 | return $pipe; |
|
| 46 | } |
||
| 48 |