| Total Complexity | 3 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | final class ComposeSimple |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @pure |
||
| 23 | */ |
||
| 24 | public static function of(): Closure |
||
| 25 | { |
||
| 26 | return |
||
| 27 | static function (callable ...$fs): Closure { |
||
| 28 | // Identity |
||
| 29 | $initial = static fn ($v) => $v; |
||
| 30 | |||
| 31 | foreach ($fs as $f) { |
||
| 32 | $initial = ComposeSimple::of1()($initial)($f); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $initial; |
||
| 36 | }; |
||
| 37 | } |
||
| 38 | |||
| 39 | private static function of1(): Closure |
||
| 43 | } |
||
| 44 | } |
||
| 45 |