◆ __construct()
__construct |
( |
string |
$body = '' , |
|
|
array |
$headers = [] , |
|
|
?int |
$status = null , |
|
|
?string |
$reason = null |
|
) |
| |
Constructor.
- Parameters
-
string | $body | the body of the response defaulting to '' |
array | $headers | an array of additional headers defaulting to an empty array |
int | null | $status | the status code of the response defaulting to a regular 200 |
string | null | $reason | the descriptional reason for a status code defaulting to the standard reason phrases defined in RFC 2616 |
◆ add_header()
add_header |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Adds an additional header to the response.
- Parameters
-
string | $key | the left hand key part |
string | $value | the right hand value part |
- Returns
- static this response object. Useful for cascading method calls.
◆ get_reason()
static get_reason |
( |
|
$status | ) |
|
|
static |
Returns the reason phrase of this response according to RFC2616.
- Parameters
-
int | $status | the response's status |
- Returns
- string the reason phrase for this response's status
◆ output()
Outputs this response to the client using "echo" and "header".
- Returns
- void
◆ send_header()
send_header |
( |
|
$header, |
|
|
|
$replace = false , |
|
|
|
$status = null |
|
) |
| |
Internally used function to actually send headers
- Parameters
-
string | $header | the HTTP header |
bool | $replace | optional; TRUE if previously sent header should be replaced - FALSE otherwise (default) |
integer | $status | optional; the HTTP response code |
- Returns
- void
◆ set_body()
Sets the body of the response.
- Parameters
-
- Returns
- static this response object. Useful for cascading method calls.
◆ set_status()
set_status |
( |
|
$status, |
|
|
|
$reason = null |
|
) |
| |
Sets the status code and an optional custom reason. If none is given, the standard reason phrase as of RFC 2616 is used.
- Parameters
-
integer | $status | the status code |
string | $reason | the custom reason, defaulting to the one given in RFC 2616 |
- Returns
- static this response object. Useful for cascading method calls.
◆ $body
◆ $headers
◆ $reason
◆ $status
The documentation for this class was generated from the following file: