Example #1
0
 /**
  * @inheritDoc
  */
 public function next(ServerRequestInterface $request) : ResponseInterface
 {
     if (!$request instanceof RequestContract) {
         // Decorate PSR-7 ServerRequest.
         $request = new Request($request);
     }
     if ($this->container->isCallable($this->route->getDomain())) {
         if ($this->container->has($this->route->getInput())) {
             /** @var Input $input */
             $input = $this->container->get($this->route->getInput());
             $arguments = $input->process($request);
         }
         /** @var Payload $payload */
         $payload = $this->container->call($this->route->getDomain(), $arguments ?? []);
     }
     /** @var Responder $responder */
     $responder = $this->container->get($this->route->getResponder());
     return $responder->run($request, $payload ?? null);
 }