StatelessResponder
FinalYes
Turns a modern-era answer into the HTTP response carrying it.
Shared by the transports that can serve that era, so a subscriptions/listen
stream and a plain result look the same on the wire whether the endpoint
serves the modern lifecycle alone or alongside the handshake one.
Tags
Table of Contents
Properties
- $logger : LoggerInterface
- $responseFactory : ResponseFactoryInterface
- $streamFactory : StreamFactoryInterface
Methods
- __construct() : mixed
- error() : ResponseInterface
- json() : ResponseInterface
- respond() : ResponseInterface
- sse() : ResponseInterface
Properties
$logger read-only
private
LoggerInterface
$logger
= new NullLogger()
$responseFactory read-only
private
ResponseFactoryInterface
$responseFactory
$streamFactory read-only
private
StreamFactoryInterface
$streamFactory
Methods
__construct()
public
__construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory[, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
- $responseFactory : ResponseFactoryInterface
- $streamFactory : StreamFactoryInterface
- $logger : LoggerInterface = new NullLogger()
error()
public
error(Error $error, int $httpStatus) : ResponseInterface
Parameters
- $error : Error
- $httpStatus : int
Return values
ResponseInterfacejson()
public
json(string $payload, int $status) : ResponseInterface
Parameters
- $payload : string
- $status : int
Return values
ResponseInterfacerespond()
public
respond(StatelessResult $result) : ResponseInterface
Parameters
- $result : StatelessResult
Return values
ResponseInterfacesse()
private
sse(callable(): Generator<string|int, mixed> $frames) : ResponseInterface
Parameters
- $frames : callable(): Generator<string|int, mixed>