The response.
Protected Properties | |
int | $code = 404 |
array | $headers |
Associative values and/or enumerated literal headers. More... | |
string | $id |
X-Response-Id , also used in logging errors. More... | |
Request | $request |
Site | $site |
int | $timestamp = 0 |
Last modification time. More... | |
Public Methods | |
__construct (Site $site) | |
void | error_exit (Throwable $error=null) |
Renders an error and exits. More... | |
void | file_exit (string $path, bool $download=false) |
Outputs a file (or requested range) and exits. More... | |
int | getCode () |
string | getId () |
int | getTimestamp () |
bool | isEmpty () |
Whether the response will only consist of headers. More... | |
bool | isModified () |
Whether the response body would be considered fresh. More... | |
void | mixed_exit ($content) |
Renders mixed content and exits. More... | |
bool | offsetExists ($key) |
null string | offsetGet ($key) |
offsetSet ($key, $value) | |
offsetUnset ($key) | |
void | redirect_exit (string $location, int $code=302) |
Issues a redirect and exits. More... | |
$this | setCacheTtl ($ttl) |
Specifies how long the response can be cached by the client. More... | |
$this | setCode (int $code) |
$this | setTimestamp (int $timestamp) |
Sets or unsets the timestamp and Last-Modified header. More... | |
$this | touch (int $timestamp) |
Updates the modification time if the given one is greater. More... | |
void | view_exit (View $view) |
Renders a view and exits. More... | |
|
protected |
Associative values and/or enumerated literal headers.
|
protected |
X-Response-Id
, also used in logging errors.
|
protected |
Last modification time.
Ignored when zero.
void error_exit | ( | Throwable | $error = null | ) |
Renders an error and exits.
null | Throwable | $error | Defaults to an HttpError with the current response code. |
void file_exit | ( | string | $path, |
bool | $download = false |
||
) |
Outputs a file (or requested range) and exits.
string | $path | |
bool | $download |
|
final |
|
final |
int getTimestamp | ( | ) |
bool isEmpty | ( | ) |
Whether the response will only consist of headers.
bool isModified | ( | ) |
Whether the response body would be considered fresh.
void mixed_exit | ( | $content | ) |
Renders mixed content and exits.
mixed | $content |
bool offsetExists | ( | $key | ) |
mixed | $key |
null string offsetGet | ( | $key | ) |
mixed | $key |
offsetSet | ( | $key, | |
$value | |||
) |
mixed | $key | |
string | $value |
offsetUnset | ( | $key | ) |
mixed | $key |
void redirect_exit | ( | string | $location, |
int | $code = 302 |
||
) |
Issues a redirect and exits.
string | $location | |
int | $code |
$this setCacheTtl | ( | $ttl | ) |
Specifies how long the response can be cached by the client.
int | DateTimeInterface | $ttl | Zero or negative time means "don't cache" |
$this setCode | ( | int | $code | ) |
int | $code |
$this setTimestamp | ( | int | $timestamp | ) |
$this touch | ( | int | $timestamp | ) |