| Conditions | 1 |
| Paths | 1 |
| Total Lines | 7 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function case(Pattern $pattern, callable $handler): MatchSubject |
||
| 13 | { |
||
| 14 | return $pattern |
||
| 15 | ->match($this->get()) |
||
| 16 | ->fold( |
||
| 17 | function (): MatchSubject { return $this; }, |
||
| 18 | function ($result) use ($handler): MatchSubject { return new ResolvedMatchSubject($handler(...$result)); } |
||
| 19 | ); |
||
| 27 |