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