Property | Type | Description | |
---|---|---|---|
$_autoConfig | array | Auto configuration properties. | |
$_classes | array | Classes used by Response. |
Method | Description | |
---|---|---|
__construct ( array $config = [] ) : void | Constructor. Adds config values to the public properties when a new object is created. | |
__toString ( ) : string | Casts the Response object to a string. This doesn't actually return a string, but does a direct render and returns an empty string. | |
cache ( mixed $expires ) : void | Controls how or whether the client browser and web proxies should cache this response. | |
headers ( string | array $key = null, mixed $value = null, boolean $replace = true ) : mixed | Expands on \net\http\Message::headers() with some magic conversions for shorthand headers. | |
render ( ) : void | Render a response by writing headers and output. Output is echoed in chunks because of an issue where echo time increases exponentially on long message bodies. | |
type ( string $type = null ) : string | Sets/Gets the content type. If 'type' is null, the method will attempt to determine the type from the params, then from the environment setting |
Method | Description | |
---|---|---|
_init ( ) : void | Sets the Location header using $config['location'] and $config['request'] passed in through the constructor if provided. | |
_writeHeaders ( string | array $headers, integer $code = null ) : void | Writes raw headers to output. |
public __construct ( array $config = [] ) : void | ||
$config | array | The available configuration options are the following. Further options are inherited from the parent classes. - `'buffer'` _integer_: Defaults to `null` - `'decode'` _boolean_: Defaults to `null`. - `'location'` _array|string|null_: Defaults to `null`. - `'request'` _object_: Defaults to `null`. |
return | void |
public __toString ( ) : string | ||
return | string | Just an empty string to satify requirements of this magic method. |
protected _writeHeaders ( string | array $headers, integer $code = null ) : void | ||
$headers | string | array | Either a raw header string, or an array of header strings. Use an array if a single header must be written multiple times with different values. Otherwise, additional values for duplicate headers will overwrite previous values. |
$code | integer | Optional. If present, forces a specific HTTP response code. Used primarily in conjunction with the 'Location' header. |
return | void |
public cache ( mixed $expires ) : void | ||
$expires | mixed | This can be a Unix timestamp indicating when the page expires, or a string indicating the relative time offset that a page should expire, i.e. `"+5 hours". Finally, `$expires` can be set to `false` to completely disable browser or proxy caching. |
return | void |
protected array $_autoConfig | ||
return | array |