Conditions | 2 |
Paths | 1 |
Total Lines | 26 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
21 | 6 | public function __invoke(): Closure |
|
22 | { |
||
23 | 6 | return |
|
24 | /** |
||
25 | * @return Closure(int=): Closure(iterable<TKey, T>): Generator<TKey, T> |
||
26 | */ |
||
27 | 6 | static fn (int $offset): Closure => |
|
28 | /** |
||
29 | * @return Closure(iterable<TKey, T>): Generator<TKey, T> |
||
30 | */ |
||
31 | 6 | static function (int $length = -1) use ($offset): Closure { |
|
32 | /** @var Closure(iterable<TKey, T>): Generator<TKey, T> $skip */ |
||
33 | 6 | $skip = (new Limit())()(-1)($offset); |
|
34 | |||
35 | 6 | if (-1 === $length) { |
|
36 | 2 | return $skip; |
|
37 | } |
||
38 | |||
39 | /** @var Closure(iterable<TKey, T>): Generator<TKey, T> $pipe */ |
||
40 | 4 | $pipe = (new Pipe())()( |
|
41 | 4 | $skip, |
|
42 | 4 | (new Limit())()($length)(0) |
|
43 | 4 | ); |
|
44 | |||
45 | // Point free style. |
||
46 | 4 | return $pipe; |
|
47 | 6 | }; |
|
50 |