예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
 {
     //Open router scope
     $outerRouter = $this->container->replace(self::class, $this);
     if (empty($this->activeRoute = $this->findRoute($request, $this->basePath))) {
         throw new ClientException(ClientException::NOT_FOUND);
     }
     //Default routes will understand about keepOutput
     $response = $this->activeRoute->perform($request->withAttribute('route', $this->activeRoute), $response, $this->container);
     //Close router scope
     $this->container->restore($outerRouter);
     return $response;
 }