ResponseEmitterInterface
in
Injectable sink for the HTTP response side-effects the WordPress adapter performs outside the PSR-15 kernel — the status code, headers, redirects, the response body, and terminating the request.
Centralising these primitives behind one seam lets the pipeline classes (InertiaAdapter, CsrfGuard, ...) build their responses as pure data and route the actual emit through an injected implementation: the production PhpSapiEmitter, or a recording fake in tests. This makes the previously untestable exit/echo/header paths assertable in-process.
Table of Contents
Methods
- header() : void
- Send a single response header as a `Name: value` pair.
- redirect() : void
- Issue a redirect to the given URL (WordPress-aware in production).
- status() : void
- Set the HTTP status code. Implementations guard against headers already having been sent.
- terminate() : never
- Terminate the request. Production exits the process; test fakes throw so the terminating branch stays assertable.
- write() : void
- Emit a chunk of the response body verbatim. Callers escape/encode first — this is the raw output boundary, not an escaping layer.
Methods
header()
Send a single response header as a `Name: value` pair.
public
header(string $name, string $value) : void
Parameters
- $name : string
- $value : string
redirect()
Issue a redirect to the given URL (WordPress-aware in production).
public
redirect(string $url) : void
Parameters
- $url : string
status()
Set the HTTP status code. Implementations guard against headers already having been sent.
public
status(int $code) : void
Parameters
- $code : int
terminate()
Terminate the request. Production exits the process; test fakes throw so the terminating branch stays assertable.
public
terminate() : never
Return values
neverwrite()
Emit a chunk of the response body verbatim. Callers escape/encode first — this is the raw output boundary, not an escaping layer.
public
write(string $body) : void
Parameters
- $body : string