Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function match(ServerRequestInterface $request)
 {
     $this->injectRoutes();
     $matchResult = $this->router->match($request);
     if ($matchResult instanceof SuccessfulMatch) {
         return RouteResult::fromRouteMatch($matchResult->getRouteName(), $matchResult->getParam('middleware'), $matchResult->getParams());
     }
     if ($matchResult instanceof MethodNotAllowed) {
         return RouteResult::fromRouteFailure($matchResult->getAllowedMethods());
     }
     return RouteResult::fromRouteFailure();
 }
Esempio n. 2
0
 public function testPathOffsetIsPassed()
 {
     $route = $this->prophesize(RouteInterface::class);
     $route->match(Argument::type(ServerRequestInterface::class), 4);
     $router = new Router($this->buildRouteCollection(['foo' => $route->reveal()]), 'http://example.com/foo');
     $router->match($this->prophesize(ServerRequestInterface::class)->reveal());
 }