protected function pipeRequestThroughMiddlewareAndRouter(
        ServerRequestInterface $request,
        RouterContract $router
    ): ResponseInterface {
        $container = $this->getContainer();

        return (new RoutingPipeline())
            ->setContainer($container)
            ->send($request)
            ->through($this->resolvedOptions['skip_middleware'] ? [] : $this->resolvedOptions['middleware'])
            ->then(static function ($request) use ($router, $container) {
                $container->instance(ServerRequestInterface::class, $request);

                return $router->dispatch($request);
            });
    }
protected function pipeRequestThroughMiddlewareAndRouter(
        ServerRequestInterface $request,
        RouterContract $router
    ): ResponseInterface {
        $container = $this->getContainer();

        return (new RoutingPipeline())
            ->setContainer($container)
            ->send($request)
            ->through($this->resolvedOptions['skip_middleware'] ? [] : $this->resolvedOptions['middleware'])
            ->then(static function ($request) use ($router, $container) {
                $container->instance(ServerRequestInterface::class, $request);

                return $router->dispatch($request);
            });
    }
protected function pipeRequestThroughMiddlewareAndRouter ( ServerRequestInterface $ request , RouterContract $ router ) : ResponseInterface { $ container = $ this -> getContainer ( ) ; return ( new RoutingPipeline ( ) ) -> setContainer ( $ container ) -> send ( $ request ) -> through ( $ this -> resolvedOptions [ 'skip_middleware' ] ? [ ] : $ this -> resolvedOptions [ 'middleware' ] ) -> then ( static function ( $ request ) use ( $ router , $ container ) { $ container -> instance ( ServerRequestInterface :: class , $ request ) ; return $ router -> dispatch ( $ request ) ; } ) ; }
Pipes the request through given middleware and dispatch a response.

@param \Psr\Http\Message\ServerRequestInterface   $request
@param \Viserio\Component\Contract\Routing\Router $router

@return \Psr\Http\Message\ResponseInterface
Pipes the request through given middleware and dispatch a response .