PHP Class Teapot\StatusLine\ResponseStatusLine

PHP version 5.3
Author: Barney Hanlon ([email protected])
Inheritance: implements Teapot\StatusLine
Datei anzeigen Open project: shrikeh/teapot

Public Methods

Method Description
__construct ( integer $code, string $reason ) Constructor.
isClientError ( ) : boolean Helper to establish if the class of the status code is client error (4xx).
isInformational ( ) : boolean Helper to establish if the class of the status code is informational (1xx).
isRedirection ( ) : boolean Helper to establish if the class of the status code is redirection (3xx).
isServerError ( ) : boolean Helper to establish if the class of the status code is server error (5xx).
isSuccessful ( ) : boolean Helper to establish if the class of the status code is successful (2xx).
reasonPhrase ( ) : string Return the reason phrase
response ( Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\ResponseInterface Add the status code and reason phrase to a Response.
statusClass ( ) : integer Return the status class of the response code.
statusCode ( ) : integer Return the response code.

Private Methods

Method Description
isStatusClass ( integer $class ) : boolean Test whether the response class matches the class passed to it.
setCode ( integer $code ) Set the code. Used in constructor to ensure the code meets the requirements for a status code.

Method Details

__construct() public method

Constructor.
public __construct ( integer $code, string $reason )
$code integer The response code
$reason string The reason phrase

isClientError() public method

Helper to establish if the class of the status code is client error (4xx).
public isClientError ( ) : boolean
return boolean

isInformational() public method

Helper to establish if the class of the status code is informational (1xx).
public isInformational ( ) : boolean
return boolean

isRedirection() public method

Helper to establish if the class of the status code is redirection (3xx).
public isRedirection ( ) : boolean
return boolean

isServerError() public method

Helper to establish if the class of the status code is server error (5xx).
public isServerError ( ) : boolean
return boolean

isSuccessful() public method

Helper to establish if the class of the status code is successful (2xx).
public isSuccessful ( ) : boolean
return boolean

reasonPhrase() public method

Return the reason phrase
public reasonPhrase ( ) : string
return string

response() public method

Add the status code and reason phrase to a Response.
public response ( Psr\Http\Message\ResponseInterface $response ) : Psr\Http\Message\ResponseInterface
$response Psr\Http\Message\ResponseInterface The response
return Psr\Http\Message\ResponseInterface

statusClass() public method

Return the status class of the response code.
public statusClass ( ) : integer
return integer

statusCode() public method

Return the response code.
public statusCode ( ) : integer
return integer