PHP Class Ergo\Http\ResponseBuilder

Show file Open project: 99designs/ergo Class Usage Examples

Public Methods

Method Description
addHeader ( string $name, string $value )
build ( ) : Response
cacheControl ( ) Sets the Cache-Control header to the strings passed as parameters.
created ( string $location ) Configures response as a '201 Created'.
expires ( $time ) Sets the Expires header based on a Unix timestamp.
forbidden ( ) Configures response as a '403 Forbidden'
found ( string $location ) Configures response as a '302 Found' temporary redirect.
methodNotAllowed ( ) Configures response as a '405 Method Not Allowed'
moved ( string $location ) Configures response as a '301 Moved Permanently' permanent redirect.
notCachable ( ) Sets the headers required to prevent response caching.
notFound ( ) Configures response as a '404 Not Found'
notModified ( ) Configures response as a '304 Not Modified'
setBody ( string $body ) Sets the body of the response.
setStatusCode ( integer $code )
view ( Ergo\View $view ) Uses a view to populate the body of the response

Method Details

addHeader() public method

public addHeader ( string $name, string $value )
$name string
$value string

build() public method

public build ( ) : Response
return Response

cacheControl() public method

Sets the Cache-Control header to the strings passed as parameters.
public cacheControl ( )

created() public method

Configures response as a '201 Created'.
public created ( string $location )
$location string

expires() public method

Sets the Expires header based on a Unix timestamp.
public expires ( $time )

forbidden() public method

Configures response as a '403 Forbidden'
public forbidden ( )

found() public method

Configures response as a '302 Found' temporary redirect.
public found ( string $location )
$location string

methodNotAllowed() public method

Configures response as a '405 Method Not Allowed'
public methodNotAllowed ( )

moved() public method

Configures response as a '301 Moved Permanently' permanent redirect.
public moved ( string $location )
$location string

notCachable() public method

Sets the headers required to prevent response caching.
public notCachable ( )

notFound() public method

Configures response as a '404 Not Found'
public notFound ( )

notModified() public method

Configures response as a '304 Not Modified'
public notModified ( )

setBody() public method

Sets the body of the response.
public setBody ( string $body )
$body string

setStatusCode() public method

public setStatusCode ( integer $code )
$code integer

view() public method

Uses a view to populate the body of the response
public view ( Ergo\View $view )
$view Ergo\View