ReplyFactoryInterface
in
Creates a response at request time for PockBuilder::replyWithFactory().
final class EchoReplyFactory implements ReplyFactoryInterface
{
public function createReply(RequestInterface $request, PockResponseBuilder $builder): ResponseInterface
{
return $builder->withBody((string) $request->getBody())->getResponse();
}
}
Tags
Table of Contents
Methods
- createReply() : ResponseInterface
- Build a PSR-7 response for the matched request.
Methods
createReply()
Build a PSR-7 response for the matched request.
public
createReply(RequestInterface $request, PockResponseBuilder $responseBuilder) : ResponseInterface
If this method throws any exception, it will be treated as with the PockBuilder::throwException call.
Parameters
- $request : RequestInterface
- $responseBuilder : PockResponseBuilder