PHP 클래스 Bluz\Response\Response

저자: Anton Shevchuk
상속: use trait Bluz\Common\Options
파일 보기 프로젝트 열기: bluzphp/framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$body result can be Controller|Layout
$code response code equal to HTTP status codes
$cookies list of cookies
$headers list of headers
$phrase HTTP Phrase
$protocol HTTP protocol version
$type CLI|HTML|JSON

공개 메소드들

메소드 설명
addHeader ( string $header, string $value ) : void Appends a header value for the specified header
addHeaders ( array $headers ) : void Merges in an associative array of headers.
clearBody ( ) : void Clear response body
getBody ( ) : Controller | Bluz\Layout\Layout Get response body
getCookie ( string $name ) : array | null Get Cookie by name
getHeader ( string $header ) : string Retrieve a header by the given case-insensitive name as a string
getHeaderAsArray ( string $header ) : string[] Retrieves a header by the given case-insensitive name as an array of strings
getHeaders ( ) : array Gets all message headers
getProtocolVersion ( ) : string Gets the HTTP protocol version as a string
getReasonPhrase ( ) : string | null Gets the response Reason-Phrase, a short textual description of the Status-Code
getStatusCode ( ) : integer Gets the response Status-Code
hasHeader ( string $header ) : boolean Checks if a header exists by the given case-insensitive name
removeHeader ( string $header ) : void Remove a specific header by case-insensitive name.
removeHeaders ( ) : void Remove all headers
send ( ) send
setBody ( mixed $body ) : void Set response body
setCookie ( string $name, string $value = '', integer | string | DateTime $expire, string $path = '/', string $domain = '', boolean $secure = false, boolean $httpOnly = false ) : void Set Cookie
setHeader ( string $header, string | string[] $value ) : void Sets a header, replacing any existing values of any headers with the same case-insensitive name
setHeaders ( array $headers ) : void Sets headers, replacing any headers that have already been set on the message
setReasonPhrase ( string $phrase ) Sets the Reason-Phrase of the response
setStatusCode ( integer $code ) : void Sets the status code of this response
switchType ( $type ) Set Response Type, one of JSON, HTML or CLI

보호된 메소드들

메소드 설명
sendCookies ( ) : void Process Cookies to Header

메소드 상세

addHeader() 공개 메소드

Existing values for the specified header will be maintained. The new value will be appended to the existing list.
public addHeader ( string $header, string $value ) : void
$header string header name to add
$value string value of the header
리턴 void

addHeaders() 공개 메소드

Each array key MUST be a string representing the case-insensitive name of a header. Each value MUST be either a string or an array of strings. For each value, the value is appended to any existing header of the same name, or, if a header does not already exist by the given name, then the header is added.
public addHeaders ( array $headers ) : void
$headers array Associative array of headers to add to the message
리턴 void

clearBody() 공개 메소드

Clear response body
public clearBody ( ) : void
리턴 void

getBody() 공개 메소드

Get response body
public getBody ( ) : Controller | Bluz\Layout\Layout
리턴 Bluz\Controller\Controller | Bluz\Layout\Layout

getCookie() 공개 메소드

Get Cookie by name
public getCookie ( string $name ) : array | null
$name string
리턴 array | null

getHeader() 공개 메소드

This method returns all of the header values of the given case-insensitive header name as a string concatenated together using a comma.
public getHeader ( string $header ) : string
$header string case-insensitive header name.
리턴 string

getHeaderAsArray() 공개 메소드

Retrieves a header by the given case-insensitive name as an array of strings
public getHeaderAsArray ( string $header ) : string[]
$header string Case-insensitive header name.
리턴 string[]

getHeaders() 공개 메소드

The keys represent the header name as it will be sent over the wire, and each value is an array of strings associated with the header. Represent the headers as a string foreach ($message->getHeaders() as $name => $values) { echo $name . ": " . implode(", ", $values); }
public getHeaders ( ) : array
리턴 array returns an associative array of the message's headers.

getProtocolVersion() 공개 메소드

The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
public getProtocolVersion ( ) : string
리턴 string HTTP protocol version.

getReasonPhrase() 공개 메소드

Because a Reason-Phrase is not a required element in response Status-Line, the Reason-Phrase value MAY be null. Implementations MAY choose to return the default RFC 2616 recommended reason phrase for the response's Status-Code.
public getReasonPhrase ( ) : string | null
리턴 string | null reason phrase, or null if unknown.

getStatusCode() 공개 메소드

The Status-Code is a 3-digit integer result code of the server's attempt to understand and satisfy the request.
public getStatusCode ( ) : integer
리턴 integer status code.

hasHeader() 공개 메소드

Checks if a header exists by the given case-insensitive name
public hasHeader ( string $header ) : boolean
$header string case-insensitive header name.
리턴 boolean returns true if any header names match the given header name using a case-insensitive string comparison. Returns false if no matching header name is found in the message.

removeHeader() 공개 메소드

Remove a specific header by case-insensitive name.
public removeHeader ( string $header ) : void
$header string HTTP header to remove
리턴 void

removeHeaders() 공개 메소드

Remove all headers
public removeHeaders ( ) : void
리턴 void

send() 공개 메소드

send
public send ( )

sendCookies() 보호된 메소드

Set-Cookie: =[; =]... [; expires=][; domain=] [; path=][; secure][; httponly]
protected sendCookies ( ) : void
리턴 void

setBody() 공개 메소드

Set response body
public setBody ( mixed $body ) : void
$body mixed
리턴 void

setCookie() 공개 메소드

Set Cookie
public setCookie ( string $name, string $value = '', integer | string | DateTime $expire, string $path = '/', string $domain = '', boolean $secure = false, boolean $httpOnly = false ) : void
$name string
$value string
$expire integer | string | DateTime
$path string
$domain string
$secure boolean
$httpOnly boolean
리턴 void

setHeader() 공개 메소드

The header name is case-insensitive. The header values MUST be a string or an array of strings.
public setHeader ( string $header, string | string[] $value ) : void
$header string header name
$value string | string[] header value(s)
리턴 void

setHeaders() 공개 메소드

The array keys MUST be a string. The array values must be either a string or an array of strings.
public setHeaders ( array $headers ) : void
$headers array Headers to set.
리턴 void

setReasonPhrase() 공개 메소드

If no Reason-Phrase is specified, implementations MAY choose to default to the RFC 2616 recommended reason phrase for the response's Status-Code.
public setReasonPhrase ( string $phrase )
$phrase string the Reason-Phrase to set.

setStatusCode() 공개 메소드

Sets the status code of this response
public setStatusCode ( integer $code ) : void
$code integer the 3-digit integer result code to set.
리턴 void

switchType() 공개 메소드

Set Response Type, one of JSON, HTML or CLI
public switchType ( $type )
$type

프로퍼티 상세

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

result can be Controller|Layout
protected $body

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

response code equal to HTTP status codes
protected $code

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

list of cookies
protected $cookies

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

list of headers
protected $headers

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

HTTP Phrase
protected $phrase

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

HTTP protocol version
protected $protocol

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

CLI|HTML|JSON
protected $type