SwooleResponseWriter
The only place in this package that touches \Swoole\Http\Response.
Pure delegation, so there is nothing here that needs testing without the extension.
Synopsis
Section titled “Synopsis”final class SwooleResponseWriter implements SwooleResponseWriterInterface
| Implements | SwooleResponseWriterInterface |
| Source | SwooleResponseWriter.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(Response $response): mixed
| Parameter | Type | Description |
|---|---|---|
$response | Response |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
end(string $body = ''): void | Finishes the response, optionally sending a final body. |
| [`header(string $name, string | list |
status(int $code): void | Sets the response status code; must be called before any body is written. |
write(string $chunk): bool |
public function end(string $body = ''): void
Finishes the response, optionally sending a final body.
Called once per request. After a streamed body the argument is omitted, because everything has already gone out through SwooleResponseWriter::write().
| Parameter | Type | Description |
|---|---|---|
$body | string |
header()
Section titled “header()”public function header(string $name, string|list<string> $value): void
An array sends one header line per value, which is how multiple Set-Cookie headers survive.
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | `string“ | list<string>` |
status()
Section titled “status()”public function status(int $code): void
Sets the response status code; must be called before any body is written.
| Parameter | Type | Description |
|---|---|---|
$code | int |
write()
Section titled “write()”public function write(string $chunk): bool
| Parameter | Type | Description |
|---|---|---|
$chunk | string |
Returns bool