Widget API/execution response.
- Todo:
- This is rather ugly and annoying besides the RESTAPI and Trails_Response which basically do the same thing (working with http status, headers and responses). Ideally all of these should use the same PSR-7 compatible HTTP Response object.
- Author
- Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version
◆ __construct()
__construct |
( |
array |
$variables = [] | ) |
|
Constructs this response with a predefined set of variables that are used to replace placeholders in headers.
- Parameters
-
array | $variables | Set of variables |
◆ addHeader()
addHeader |
( |
|
$name, |
|
|
|
$content, |
|
|
|
$append = false |
|
) |
| |
Adds a new header to the response. The header name and content may contain placeholders in the form ":var" which are replaced with the predefined set of variables in the constructor.
- Parameters
-
string | $name | Name of the header |
string | $contetn | Content of the header |
bool | $append | Should the header be appended to a previously added header with the same name or should it replace that header (defaults to false, replace) |
◆ addHeaders()
addHeaders |
( |
array |
$headers, |
|
|
|
$append = false |
|
) |
| |
Adds an associative array of headers (the key is name of the header, the value is the content).
- Parameters
-
array | $headers | Array of headers |
bool | $append | Append or replace existing headers ( |
- See also
- addheader)
◆ connectWithRouteMap()
Connects this response with a route map of the Stud.IP core api. This means, that this response is mapped to the route map's response with all it's headers, the status and the content.
- Parameters
-
RouteMap | $map | The connected route map |
◆ connectWithTrailsResponse()
connectWithTrailsResponse |
( |
Trails_Response |
$response | ) |
|
Connects this response with the response of a trails controller. This means, that this response is mapped to the trails response with all it's headers, the status and the content.
- Parameters
-
Trails_Response | $response | The connected trails response |
◆ getContent()
Returns the content of the response. If the content was set as a flexi template, this will return the rendered template.
- Returns
- string Content of the response
◆ getHeaders()
Returns the previously set headers.
- Returns
- array of header (key = name, value = content)
◆ getStatus()
Returns the status code of the response. If the status is not a redirect (300), an error (400) or an exception (500) and no content has been set, the status will always return 204 (= No Content).
- Returns
- int http status of the response
◆ setContent()
Sets the content of the response.
- Parameters
-
mixed | $content | Content of the response (might be a string or a flexi template) |
◆ setStatus()
Sets the http status of the response.
- Parameters
-
int | $status | Status code of the response |
◆ $content
◆ $headers
◆ $status
◆ $variables
The documentation for this class was generated from the following file: