PHP 클래스 lithium\net\http\Response

상속: extends Message
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$cookies array Cookies are stored as arrays of $name => $value where $value is an associative array or an array of associative arrays which contain at minimum a value key and optionally, expire, path, domain, secure, and/or httponly keys corresponding to the parameters of PHP setcookie().
$encoding string Character encoding.
$status array Status code and message.

보호된 프로퍼티들

프로퍼티 타입 설명
$_statuses array Status codes.

공개 메소드들

메소드 설명
__construct ( array $config = [] ) : void Constructor. Adds config values to the public properties when a new object is created.
__toString ( ) : string Return the response as a string.
body ( mixed $data = null, array $options = [] ) : array Add data to or compile and return the HTTP message body, optionally decoding its parts according to content type.
cookies ( string $key = null, string $value = null ) : mixed Add a cookie to header output, or return a single cookie or full cookie list.
digest ( ) : array Looks at the WWW-Authenticate. Will return array of key/values if digest.
status ( string $key = null, string $status = null ) : string Set and get the status for the response.

보호된 메소드들

메소드 설명
_cookies ( ) : array Render Set-Cookie headers, urlencoding invalid characters.
_httpChunkedDecode ( string $body ) : string Decodes content bodies transferred with HTTP chunked encoding.
_parseCookies ( array $headers ) Parse Set-Cookie headers.
_parseMessage ( string $body ) : After Accepts an entire HTTP message including headers and body, and parses it into a message body an array of headers, and the HTTP status.

메소드 상세

__construct() 공개 메소드

Constructor. Adds config values to the public properties when a new object is created.
또한 보기: lithium\net\http\Message::__construct()
또한 보기: lithium\net\Message::__construct()
public __construct ( array $config = [] ) : void
$config array The available configuration options are the following. Further options are inherited from the parent classes. - `'message'` _string_: Defaults to `null`. - `'status'` _mixed_: Defaults to `null`. - `'type'` _string_: Defaults to `null`. - `'cookies'` _array_: Defaults to `array()`.
리턴 void

__toString() 공개 메소드

Return the response as a string.
public __toString ( ) : string
리턴 string

_cookies() 보호된 메소드

NOTE: Technically '+' is a valid character, but many browsers erroneously convert these to spaces, so we must escape this too.
protected _cookies ( ) : array
리턴 array Array of `Set-Cookie` headers or `null` if no cookies to set.

_httpChunkedDecode() 보호된 메소드

Decodes content bodies transferred with HTTP chunked encoding.
protected _httpChunkedDecode ( string $body ) : string
$body string A chunked HTTP message body.
리턴 string Returns the value of `$body` with chunks decoded, but only if the value of the `Transfer-Encoding` header is set to `'chunked'`. Otherwise, returns `$body` unmodified.

_parseCookies() 보호된 메소드

Parse Set-Cookie headers.
protected _parseCookies ( array $headers )
$headers array Array of `Set-Cookie` headers or `null` if no cookies to set.

_parseMessage() 보호된 메소드

Accepts an entire HTTP message including headers and body, and parses it into a message body an array of headers, and the HTTP status.
protected _parseMessage ( string $body ) : After
$body string The full body of the message.
리턴 After parsing out other message components, returns just the message body.

body() 공개 메소드

Add data to or compile and return the HTTP message body, optionally decoding its parts according to content type.
또한 보기: lithium\net\Message::body()
또한 보기: lithium\net\http\Message::_decode()
public body ( mixed $data = null, array $options = [] ) : array
$data mixed
$options array - `'buffer'` _integer_: split the body string - `'encode'` _boolean_: encode the body based on the content type - `'decode'` _boolean_: decode the body based on the content type
리턴 array

cookies() 공개 메소드

This function's parameters are designed to be analogous to setcookie(). Function parameters expire, path, domain, secure, and httponly may be passed in as an associative array alongside value inside $value. NOTE: Cookies values are expected to be scalar. This function will not serialize cookie values. If you wish to store a non-scalar value, you must serialize the data first. NOTE: Cookie values are stored as an associative array containing at minimum a value key. Cookies which have been set multiple times do not overwrite each other. Rather they are stored as an array of associative arrays.
public cookies ( string $key = null, string $value = null ) : mixed
$key string
$value string
리턴 mixed

digest() 공개 메소드

Looks at the WWW-Authenticate. Will return array of key/values if digest.
public digest ( ) : array
리턴 array

status() 공개 메소드

Set and get the status for the response.
public status ( string $key = null, string $status = null ) : string
$key string Optional. Set to `'code'` or `'message'` to return just the code or message of the status, otherwise returns the full status header.
$status string The code or message of the status you wish to set.
리턴 string Returns the full HTTP status, with version, code and message or dending on $key just the code or message.

프로퍼티 상세

$_statuses 보호되어 있는 프로퍼티

Status codes.
protected array $_statuses
리턴 array

$cookies 공개적으로 프로퍼티

Cookies are stored as arrays of $name => $value where $value is an associative array or an array of associative arrays which contain at minimum a value key and optionally, expire, path, domain, secure, and/or httponly keys corresponding to the parameters of PHP setcookie().
또한 보기: lithium\net\http\Response::cookies()
public array $cookies
리턴 array

$encoding 공개적으로 프로퍼티

Character encoding.
public string $encoding
리턴 string

$status 공개적으로 프로퍼티

Status code and message.
public array $status
리턴 array