| Conditions | 4 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function extract(ServerRequestInterface $request): Range |
||
| 31 | { |
||
| 32 | $range = $this |
||
| 33 | ->extractors |
||
| 34 | ->reduce( |
||
| 35 | null, |
||
| 36 | function($carry, ExtractorInterface $extractor) use ($request) { |
||
| 37 | if ($carry instanceof Range) { |
||
| 38 | return $carry; |
||
| 39 | } |
||
| 40 | |||
| 41 | try { |
||
| 42 | return $extractor->extract($request); |
||
| 43 | } catch (RangeNotFoundException $e) { |
||
| 44 | //pass |
||
| 45 | } |
||
| 46 | } |
||
| 47 | ); |
||
| 48 | |||
| 49 | if ($range instanceof Range) { |
||
| 50 | return $range; |
||
| 51 | } |
||
| 52 | |||
| 53 | throw new RangeNotFoundException; |
||
| 54 | } |
||
| 55 | } |
||
| 56 |