public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if ($this->index >= count($this->middlewares)) {
            throw new OutOfBoundsException('Reached end of middleware stack. Does your controller return a response ?');
        }

        $middleware = $this->middlewares[$this->index++];

        return $middleware->process($request, $this);
    }
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if ($this->index >= count($this->middlewares)) {
            throw new OutOfBoundsException('Reached end of middleware stack. Does your controller return a response ?');
        }

        $middleware = $this->middlewares[$this->index++];

        return $middleware->process($request, $this);
    }
public function handle ( ServerRequestInterface $ request ) : ResponseInterface { if ( $ this -> index >= count ( $ this -> middlewares ) ) { throw new OutOfBoundsException ( 'Reached end of middleware stack. Does your controller return a response ?' ) ; } $ middleware = $ this -> middlewares [ $ this -> index ++ ] ; return $ middleware -> process ( $ request , $ this ) ; }
Execute the middleware stack.

@param ServerRequestInterface $request

@return ResponseInterface
Execute the middleware stack .