PHP 클래스 Scalr\Api\Rest\Http\Response

부터: 5.4.0 (10.02.2015)
저자: Vitaliy Demidov ([email protected])
파일 보기 프로젝트 열기: scalr/scalr 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$messages

공개 메소드들

메소드 설명
__construct ( string $body = '', integer $status = 200, array $headers = [] ) Constructor
addBody ( string $body ) : Response Add to body
addHeaders ( array $headers ) : Response Adds headers
finalize ( ) : array Prepares response to be sent
getBody ( ) : string Gets response body
getCodeMessage ( integer $code ) : string Gets the message for the specified HTTP code
getContentLength ( ) : number Gets content length
getContentType ( ) : string Gets content type as header Content-Type value
getHeader ( string $name ) : string Gets specified header
getHeaders ( ) : array Gets all headers
getStatus ( ) : number Gets response status code
redirect ( string $url, integer $status = 302 ) : Response Redirect
removeHeader ( string $name ) : Response Removes specified header
setBody ( string $body ) : Response Sets response body
setContentType ( string $type, string $encoding = "utf-8" ) Sets content MIME type and encoding
setHeader ( string $name, string $value ) : Response Sets header
setHeaders ( array $headers ) : Response Sets headers
setStatus ( integer $status ) : Response Sets status code

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string $body = '', integer $status = 200, array $headers = [] )
$body string The HTTP response body
$status integer The HTTP response status
$headers array The HTTP response headers

addBody() 공개 메소드

Add to body
public addBody ( string $body ) : Response
$body string The body
리턴 Response

addHeaders() 공개 메소드

Adds headers
public addHeaders ( array $headers ) : Response
$headers array The response headers
리턴 Response

finalize() 공개 메소드

Prepares response to be sent
public finalize ( ) : array
리턴 array Returns array looks like array(status, headers, body)

getBody() 공개 메소드

Gets response body
public getBody ( ) : string
리턴 string

getCodeMessage() 공개 정적인 메소드

Gets the message for the specified HTTP code
public static getCodeMessage ( integer $code ) : string
$code integer
리턴 string Returns the message for the specified HTTP code

getContentLength() 공개 메소드

Gets content length
public getContentLength ( ) : number
리턴 number Returns content length

getContentType() 공개 메소드

Gets content type as header Content-Type value
public getContentType ( ) : string
리턴 string

getHeader() 공개 메소드

Gets specified header
public getHeader ( string $name ) : string
$name string The name of the HTTP Header
리턴 string Returns the value of the specified HTTP Header

getHeaders() 공개 메소드

Gets all headers
public getHeaders ( ) : array
리턴 array Returns all HTTP headers as array

getStatus() 공개 메소드

Gets response status code
public getStatus ( ) : number
리턴 number Returns status code

redirect() 공개 메소드

Redirect
public redirect ( string $url, integer $status = 302 ) : Response
$url string The redirect url
$status integer optional The redirect HTTP status code
리턴 Response

removeHeader() 공개 메소드

Removes specified header
public removeHeader ( string $name ) : Response
$name string A header name
리턴 Response

setBody() 공개 메소드

Sets response body
public setBody ( string $body ) : Response
$body string The response body
리턴 Response

setContentType() 공개 메소드

Sets content MIME type and encoding
public setContentType ( string $type, string $encoding = "utf-8" )
$type string Content MIME type
$encoding string optional Content encoding

setHeader() 공개 메소드

Sets header
public setHeader ( string $name, string $value ) : Response
$name string A header name ('heaer-name')
$value string A value
리턴 Response

setHeaders() 공개 메소드

Sets headers
public setHeaders ( array $headers ) : Response
$headers array The response headers looks like array('header-name' => value)
리턴 Response

setStatus() 공개 메소드

Sets status code
public setStatus ( integer $status ) : Response
$status integer
리턴 Response

프로퍼티 상세

$messages 보호되어 있는 정적으로 프로퍼티

protected static $messages