Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
22 | 10 | public function __invoke(): Closure |
|
23 | { |
||
24 | 10 | return |
|
25 | /** |
||
26 | * @return Closure(iterable<TKey, T>): Generator<TKey, string> |
||
27 | */ |
||
28 | 10 | static function (string $glue): Closure { |
|
29 | /** @var Closure(iterable<TKey, T>): Generator<TKey, string> $pipe */ |
||
30 | 10 | $pipe = (new Pipe())()( |
|
31 | 10 | (new Intersperse())()($glue)(1)(0), |
|
32 | 10 | (new Limit())()(-1)(1), |
|
33 | 10 | (new Reduce())()( |
|
34 | 10 | static fn (string $carry, string|Stringable $item): string => $carry .= (string) $item |
|
35 | 10 | )('') |
|
36 | 10 | ); |
|
37 | |||
38 | // Point free style. |
||
39 | 10 | return $pipe; |
|
40 | 10 | }; |
|
43 |