ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct ( $status=StatusCode::HTTP_OK, HeadersInterface $headers=null, StreamInterface $body=null) | |
Create new HTTP response. More... | |
__clone () | |
This method is applied to the cloned object after PHP performs an initial shallow-copy. More... | |
getStatusCode () | |
Gets the response status code. More... | |
withStatus ($code, $reasonPhrase='') | |
Return an instance with the specified status code and, optionally, reason phrase. More... | |
getReasonPhrase () | |
Gets the response reason phrase associated with the status code. More... | |
withHeader ($name, $value) | |
Return an instance with the provided value replacing the specified header. More... | |
write ($data) | |
Write data to the response body. More... | |
withRedirect ($url, $status=null) | |
Redirect. More... | |
withJson ($data, $status=null, $encodingOptions=0) | |
Json. More... | |
isEmpty () | |
Is this response empty? More... | |
isInformational () | |
Is this response informational? More... | |
isOk () | |
Is this response OK? More... | |
isSuccessful () | |
Is this response successful? More... | |
isRedirect () | |
Is this response a redirect? More... | |
isRedirection () | |
Is this response a redirection? More... | |
isForbidden () | |
Is this response forbidden? More... | |
isNotFound () | |
Is this response not Found? More... | |
isClientError () | |
Is this response a client error? More... | |
isServerError () | |
Is this response a server error? More... | |
__toString () | |
Convert response to string. More... | |
Public Member Functions inherited from Slim\Http\Message | |
__set ($name, $value) | |
Disable magic setter to ensure immutability. More... | |
getProtocolVersion () | |
Retrieves the HTTP protocol version as a string. More... | |
withProtocolVersion ($version) | |
Return an instance with the specified HTTP protocol version. More... | |
getHeaders () | |
Retrieves all message header values. More... | |
hasHeader ($name) | |
Checks if a header exists by the given case-insensitive name. More... | |
getHeader ($name) | |
Retrieves a message header value by the given case-insensitive name. More... | |
getHeaderLine ($name) | |
Retrieves a comma-separated string of the values for a single header. More... | |
withHeader ($name, $value) | |
Return an instance with the provided value replacing the specified header. More... | |
withAddedHeader ($name, $value) | |
Return an instance with the specified header appended with the given value. More... | |
withoutHeader ($name) | |
Return an instance without the specified header. More... | |
getBody () | |
Gets the body of the message. More... | |
withBody (StreamInterface $body) | |
Return an instance with the specified message body. More... | |
Data Fields | |
const | EOL = "\r\n" |
Protected Member Functions | |
filterStatus ($status) | |
Filter HTTP status code. More... | |
Protected Attributes | |
$status = StatusCode::HTTP_OK | |
$reasonPhrase = '' | |
Protected Attributes inherited from Slim\Http\Message | |
$protocolVersion = '1.1' | |
$headers | |
$body | |
Static Protected Attributes | |
static | $messages |
Static Protected Attributes inherited from Slim\Http\Message | |
static | $validProtocolVersions |
This class represents an HTTP response. It manages the response status, headers, and body according to the PSR-7 standard.
https://github.com/php-fig/http-message/blob/master/src/ResponseInterface.php
Definition at line 27 of file Response.php.
Slim\Http\Response::__construct | ( | $status = StatusCode::HTTP_OK , |
|
HeadersInterface | $headers = null , |
||
StreamInterface | $body = null |
||
) |
Create new HTTP response.
int | $status | The response status code. |
HeadersInterface | null | $headers | The response headers. |
StreamInterface | null | $body | The response body. |
Definition at line 134 of file Response.php.
References Slim\Http\Message\$body, Slim\Http\Message\$headers, Slim\Http\Response\$status, and Slim\Http\Response\filterStatus().
Slim\Http\Response::__clone | ( | ) |
This method is applied to the cloned object after PHP performs an initial shallow-copy.
This method completes a deep-copy by creating new objects for the cloned object's internal reference pointers.
Definition at line 150 of file Response.php.
References Slim\Http\Message\$headers.
Slim\Http\Response::__toString | ( | ) |
Convert response to string.
Note: This method is not part of the PSR-7 standard.
Definition at line 512 of file Response.php.
References $name, Sabre\VObject\$output, $values, Slim\Http\Response\EOL, Slim\Http\Message\getBody(), Slim\Http\Message\getHeaderLine(), Slim\Http\Message\getHeaders(), Slim\Http\Message\getProtocolVersion(), Slim\Http\Response\getReasonPhrase(), and Slim\Http\Response\getStatusCode().
|
protected |
Filter HTTP status code.
int | $status | HTTP status code. |
Definition at line 222 of file Response.php.
References Slim\Http\Response\$status, Slim\Http\StatusCode\HTTP_CONTINUE, and Slim\Http\StatusCode\HTTP_NETWORK_CONNECTION_TIMEOUT_ERROR.
Referenced by Slim\Http\Response\__construct(), and Slim\Http\Response\withStatus().
Slim\Http\Response::getReasonPhrase | ( | ) |
Gets the response reason phrase associated with the status code.
Because a reason phrase is not a required element in a response status line, the reason phrase value MAY be null. Implementations MAY choose to return the default RFC 7231 recommended reason phrase (or those listed in the IANA HTTP Status Code Registry) for the response's status code.
http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml string Reason phrase; must return an empty string if none present.
Implements Psr\Http\Message\ResponseInterface.
Definition at line 247 of file Response.php.
References $messages, Slim\Http\Response\$reasonPhrase, and Slim\Http\Response\$status.
Referenced by Slim\Http\Response\__toString().
Slim\Http\Response::getStatusCode | ( | ) |
Gets the response status code.
The status code is a 3-digit integer result code of the server's attempt to understand and satisfy the request.
Implements Psr\Http\Message\ResponseInterface.
Definition at line 167 of file Response.php.
References Slim\Http\Response\$status.
Referenced by Slim\Http\Response\__toString(), Slim\Http\Response\isClientError(), Slim\Http\Response\isEmpty(), Slim\Http\Response\isForbidden(), Slim\Http\Response\isInformational(), Slim\Http\Response\isNotFound(), Slim\Http\Response\isOk(), Slim\Http\Response\isRedirect(), Slim\Http\Response\isRedirection(), Slim\Http\Response\isServerError(), Slim\Http\Response\isSuccessful(), and Slim\Http\Response\withRedirect().
Slim\Http\Response::isClientError | ( | ) |
Is this response a client error?
Note: This method is not part of the PSR-7 standard.
Definition at line 487 of file Response.php.
References Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_BAD_REQUEST, and Slim\Http\StatusCode\HTTP_INTERNAL_SERVER_ERROR.
Slim\Http\Response::isEmpty | ( | ) |
Is this response empty?
Note: This method is not part of the PSR-7 standard.
Definition at line 376 of file Response.php.
References Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_NO_CONTENT, Slim\Http\StatusCode\HTTP_NOT_MODIFIED, and Slim\Http\StatusCode\HTTP_RESET_CONTENT.
Slim\Http\Response::isForbidden | ( | ) |
Is this response forbidden?
Note: This method is not part of the PSR-7 standard.
Definition at line 463 of file Response.php.
References Slim\Http\Response\getStatusCode(), and Slim\Http\StatusCode\HTTP_FORBIDDEN.
Slim\Http\Response::isInformational | ( | ) |
Is this response informational?
Note: This method is not part of the PSR-7 standard.
Definition at line 391 of file Response.php.
References Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_CONTINUE, and Slim\Http\StatusCode\HTTP_OK.
Slim\Http\Response::isNotFound | ( | ) |
Is this response not Found?
Note: This method is not part of the PSR-7 standard.
Definition at line 475 of file Response.php.
References Slim\Http\Response\getStatusCode(), and Slim\Http\StatusCode\HTTP_NOT_FOUND.
Slim\Http\Response::isOk | ( | ) |
Is this response OK?
Note: This method is not part of the PSR-7 standard.
Definition at line 403 of file Response.php.
References Slim\Http\Response\getStatusCode(), and Slim\Http\StatusCode\HTTP_OK.
Slim\Http\Response::isRedirect | ( | ) |
Is this response a redirect?
Note: This method is not part of the PSR-7 standard.
Definition at line 428 of file Response.php.
References Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_FOUND, Slim\Http\StatusCode\HTTP_MOVED_PERMANENTLY, Slim\Http\StatusCode\HTTP_PERMANENT_REDIRECT, Slim\Http\StatusCode\HTTP_SEE_OTHER, and Slim\Http\StatusCode\HTTP_TEMPORARY_REDIRECT.
Slim\Http\Response::isRedirection | ( | ) |
Is this response a redirection?
Note: This method is not part of the PSR-7 standard.
Definition at line 449 of file Response.php.
References Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_BAD_REQUEST, and Slim\Http\StatusCode\HTTP_MULTIPLE_CHOICES.
Slim\Http\Response::isServerError | ( | ) |
Is this response a server error?
Note: This method is not part of the PSR-7 standard.
Definition at line 500 of file Response.php.
References Slim\Http\Response\getStatusCode(), and Slim\Http\StatusCode\HTTP_INTERNAL_SERVER_ERROR.
Slim\Http\Response::isSuccessful | ( | ) |
Is this response successful?
Note: This method is not part of the PSR-7 standard.
Definition at line 415 of file Response.php.
References Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_MULTIPLE_CHOICES, and Slim\Http\StatusCode\HTTP_OK.
Slim\Http\Response::withHeader | ( | $name, | |
$value | |||
) |
Return an instance with the provided value replacing the specified header.
If a Location header is set and the status code is 200, then set the status code to 302 to mimic what PHP does. See https://github.com/slimphp/Slim/issues/1730
string | $name | Case-insensitive header field name. |
string|string[] | $value Header value(s). |
Implements Psr\Http\Message\MessageInterface.
Definition at line 273 of file Response.php.
References $name, Slim\Http\StatusCode\HTTP_FOUND, and Slim\Http\StatusCode\HTTP_OK.
Referenced by Slim\Http\Response\withRedirect().
Slim\Http\Response::withJson | ( | $data, | |
$status = null , |
|||
$encodingOptions = 0 |
|||
) |
Json.
Note: This method is not part of the PSR-7 standard.
This method prepares the response object to return an HTTP Json response to the client.
mixed | $data | The data |
int | $status | The HTTP status code. |
int | $encodingOptions | Json encoding options |
Definition at line 352 of file Response.php.
References $data, $response, Slim\Http\Response\$status, and Slim\Http\Message\withBody().
Slim\Http\Response::withRedirect | ( | $url, | |
$status = null |
|||
) |
Redirect.
Note: This method is not part of the PSR-7 standard.
This method prepares the response object to return an HTTP Redirect response to the client.
string | UriInterface | $url | The redirect destination. |
int | null | $status | The redirect HTTP status code. |
Definition at line 323 of file Response.php.
References Slim\Http\Response\$status, $url, Slim\Http\Response\getStatusCode(), Slim\Http\StatusCode\HTTP_FOUND, Slim\Http\StatusCode\HTTP_OK, and Slim\Http\Response\withHeader().
Slim\Http\Response::withStatus | ( | $code, | |
$reasonPhrase = '' |
|||
) |
Return an instance with the specified status code and, optionally, reason phrase.
If no reason phrase is specified, implementations MAY choose to default to the RFC 7231 or IANA recommended reason phrase for the response's status code.
This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the updated status and reason phrase.
http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml int $code The 3-digit integer result code to set. string $reasonPhrase The reason phrase to use with the provided status code; if none is provided, implementations MAY use the defaults as suggested in the HTTP specification. static For invalid status code arguments.
Implements Psr\Http\Message\ResponseInterface.
Definition at line 192 of file Response.php.
References $code, $messages, Slim\Http\Response\$reasonPhrase, and Slim\Http\Response\filterStatus().
Slim\Http\Response::write | ( | $data | ) |
Write data to the response body.
Note: This method is not part of the PSR-7 standard.
Proxies to the underlying stream and writes the provided data to it.
string | $data |
Definition at line 300 of file Response.php.
References $data, and Slim\Http\Message\getBody().
|
staticprotected |
Definition at line 48 of file Response.php.
|
protected |
Definition at line 41 of file Response.php.
Referenced by Slim\Http\Response\getReasonPhrase(), and Slim\Http\Response\withStatus().
|
protected |
Definition at line 34 of file Response.php.
Referenced by Slim\Http\Response\__construct(), Slim\Http\Response\filterStatus(), Slim\Http\Response\getReasonPhrase(), Slim\Http\Response\getStatusCode(), Slim\Http\Response\withJson(), and Slim\Http\Response\withRedirect().
const Slim\Http\Response::EOL = "\r\n" |
Definition at line 125 of file Response.php.
Referenced by Slim\Http\Response\__toString().