Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
23 | 30 | public function __invoke(): Closure |
|
24 | { |
||
25 | 30 | return |
|
26 | /** |
||
27 | * @param callable((T|V), T, TKey, iterable<TKey, T>): V $callback |
||
28 | * |
||
29 | * @return Closure(iterable<TKey, T>): Generator<int|TKey, V> |
||
30 | */ |
||
31 | 30 | static function (callable $callback): Closure { |
|
32 | /** @var Closure(iterable<TKey, T>):(Generator<int|TKey, V>) $pipe */ |
||
33 | 30 | $pipe = (new Pipe())()( |
|
34 | 30 | (new ScanLeft1())()($callback), |
|
35 | 30 | (new Last())() |
|
36 | 30 | ); |
|
37 | |||
38 | // Point free style. |
||
39 | 30 | return $pipe; |
|
40 | 30 | }; |
|
43 |