public process ( Psr\Http\Message\RequestInterface $request ) : Psr\Http\Message\ResponseInterface | ||
$request | Psr\Http\Message\RequestInterface | |
Результат | Psr\Http\Message\ResponseInterface |
/** * @todo Remove for 2.0.0, as the $done handler will no longer be used. * @group http-interop */ public function testNextCanUseADelegateForTheDoneHandler() { $delegate = $this->prophesize(DelegateInterface::class); $delegate->process(Argument::type(RequestInterface::class))->willReturn('FOOBAR'); $next = new Next($this->queue, $delegate->reveal()); $this->assertEquals('FOOBAR', $next->process($this->request)); }
/** * http-interop invocation: single-pass with delegate. * * Executes the internal pipeline, passing $delegate as the "final * handler" in cases when the pipeline exhausts itself. * * @param Request $request * @param DelegateInterface $delegate * @return Response */ public function process(Request $request, DelegateInterface $delegate) { $response = $this->responsePrototype; $next = new Next($this->pipeline, $delegate); if ($response) { $next->setResponsePrototype($response); } if ($this->raiseThrowables) { $next->raiseThrowables(); } $result = $next->process($request); return $result instanceof Response ? $result : $response; }