Property | Type | Description | |
---|---|---|---|
$httpStatuses | An array of http status codes by RFC2616 standard or some other if noted by comment. |
Method | Description | |
---|---|---|
__construct ( string $content = '', integer $statusCode = 200, array $headers = [] ) | Constructs the Response object. | |
cacheControl ( ) : |
Get access to cache control headers. | |
create ( string $content = '', integer $statusCode = 200, array $headers = [] ) : |
Static constructor. | |
getCharset ( ) : string | Returns currently set response charset. | |
getContent ( ) : string | Get response content. | |
getContentType ( ) : string | Returns the currently set content type. | |
getHeaders ( ) : array | Returns an array of current headers. | |
getStatusCode ( ) : integer | Returns current status code. | |
send ( ) | Sends both the headers and the content to the browser. | |
sendContent ( ) | Sends the content to the browser. | |
sendHeaders ( ) | Send the currently defined headers. | |
setAsNotModified ( ) | Sets the response as not modified. | |
setCharset ( string $charset ) | Set the response charset. | |
setContent ( string $content ) | Set response content. | |
setContentType ( string $contentType ) | Sets the Content-Type header value. | |
setHeader ( string $key, string $value ) | Sets or adds a header. | |
setStatusCode ( integer $statusCode, string $message = '' ) | Set HTTP response status code. The status code must be a valid HTTP status code, or an exception will be thrown. |
public __construct ( string $content = '', integer $statusCode = 200, array $headers = [] ) | ||
$content | string | Content that will be attached to the response. |
$statusCode | integer | HTTP status code that will be sent back to the user. |
$headers | array | Additional headers that should be attached to the response. |
public cacheControl ( ) : |
||
return |
public static create ( string $content = '', integer $statusCode = 200, array $headers = [] ) : |
||
$content | string | Content that will be attached to the response. |
$statusCode | integer | HTTP status code that will be sent back to the user. |
$headers | array | Additional headers that should be attached to the response. |
return |
public getCharset ( ) : string | ||
return | string |
public getContentType ( ) : string | ||
return | string |
public getHeaders ( ) : array | ||
return | array |
public getStatusCode ( ) : integer | ||
return | integer |
public setCharset ( string $charset ) | ||
$charset | string | Charset name. |
public setContent ( string $content ) | ||
$content | string | Response content. |
public setContentType ( string $contentType ) | ||
$contentType | string |
public setStatusCode ( integer $statusCode, string $message = '' ) | ||
$statusCode | integer | Http status code. |
$message | string | Http status message. If not set we will use the default message by RFC2616. |