Response class for the rest api
- Author
- mlunz.nosp@m.ena@.nosp@m.uos.d.nosp@m.e GPL 2 or later
- Since
- Stud.IP 3.0
__construct |
( |
|
$body = '' , |
|
|
|
$status = 200 , |
|
|
|
$headers = [] |
|
) |
| |
Constructor, sets vital information if provided.
- Parameters
-
String | $body | Body contents of the response, optional, defaults to empty string |
int | $status | HTTP status code, optional, defaults to 200 |
Array | $headers | HTTP headers, optional, defaults to no headers |
finish |
( |
|
$content_renderer | ) |
|
Finishes the response with the given response renderer.
- Parameters
-
Renderer\DefaultRenderer | $content_renderer | Used response renderer, only applied if body is not a callable closure |
Detects whether the response status is of success type (HTTP status 2xx)
- Returns
- bool True if status is of success type, false otherwise
offsetSet |
( |
|
$offset, |
|
|
|
$value |
|
) |
| |
Returns the reason phrase of this response according to RFC2616.
- Returns
- string the reason phrase for this response's status
sendHeader |
( |
|
$header, |
|
|
|
$replace = FALSE , |
|
|
|
$status = NULL |
|
) |
| |
Internally used function to actually send headers
- Parameters
-
string | the HTTP header |
bool | optional; TRUE if previously sent header should be replaced - FALSE otherwise (default) |
integer | optional; the HTTP response code |
- Returns
- void
The documentation for this class was generated from the following file: