| Total Complexity | 10 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class MatchingResult implements MiddlewareInterface |
||
| 12 | { |
||
| 13 | private bool $success; |
||
| 14 | private Route $route; |
||
| 15 | private array $parameters = []; |
||
| 16 | private array $methods = []; |
||
| 17 | |||
| 18 | private function __construct() |
||
| 19 | { |
||
| 20 | } |
||
| 21 | |||
| 22 | 3 | public static function fromSuccess(Route $route, array $parameters): self |
|
| 23 | { |
||
| 24 | 3 | $new = new self(); |
|
| 25 | 3 | $new->success = true; |
|
| 26 | 3 | $new->route = $route; |
|
| 27 | 3 | $new->parameters = $parameters; |
|
| 28 | 3 | return $new; |
|
| 29 | } |
||
| 30 | |||
| 31 | 5 | public static function fromFailure(array $methods): self |
|
| 32 | { |
||
| 33 | 5 | $new = new self(); |
|
| 34 | 5 | $new->methods = $methods; |
|
| 35 | 5 | $new->success = false; |
|
| 36 | 5 | return $new; |
|
| 37 | } |
||
| 38 | |||
| 39 | 5 | public function isSuccess(): bool |
|
| 42 | } |
||
| 43 | |||
| 44 | 5 | public function isMethodFailure(): bool |
|
| 45 | { |
||
| 46 | 5 | return !$this->success && $this->methods !== Method::ANY; |
|
| 47 | } |
||
| 48 | |||
| 49 | 2 | public function parameters(): array |
|
| 50 | { |
||
| 51 | 2 | return $this->parameters; |
|
| 52 | } |
||
| 53 | |||
| 54 | 2 | public function methods(): array |
|
| 57 | } |
||
| 58 | |||
| 59 | 3 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 66 | } |
||
| 67 | } |
||
| 68 |