Zend\Stratigility\Next::dispatchNextDelegate PHP Method

dispatchNextDelegate() private method

For DelegateInterface implementations, calls the process method with only the request instance. For callables, calls with request, response, and error.
private dispatchNextDelegate ( callable | Interop\Http\Middleware\DelegateInterface $nextDelegate, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response = null, mixed $err = null ) : Psr\Http\Message\ResponseInterface
$nextDelegate callable | Interop\Http\Middleware\DelegateInterface
$request Psr\Http\Message\RequestInterface
$response Psr\Http\Message\ResponseInterface
$err mixed
return Psr\Http\Message\ResponseInterface
    private function dispatchNextDelegate($nextDelegate, RequestInterface $request, ResponseInterface $response = null, $err = null)
    {
        if ($nextDelegate instanceof DelegateInterface && (!$nextDelegate instanceof Next || $err === null)) {
            return $nextDelegate->process($request);
        }
        $response = $response ?: $this->getResponsePrototype();
        $this->validateServerRequest($request);
        return $nextDelegate($request, $response, $err);
    }