PHP Class Lukasoppermann\Httpstatus\Httpstatus

Inheritance: implements Countabl\Countable, implements IteratorAggregat\IteratorAggregate
Datei anzeigen Open project: lukasoppermann/http-status Class Usage Examples

Protected Properties

Property Type Description
$httpStatus

Public Methods

Method Description
__construct ( Traversable | array $statusArray = [] ) Create a new Httpstatus Instance.
count ( )
getIterator ( )
getReasonPhrase ( string $statusCode ) : string Get the text for a given status code.
getResponseClass ( integer $statusCode ) : integer Determines the response class of a response code.
getStatusCode ( string $statusText ) : string Get the code for a given status text.
hasReasonPhrase ( integer $statusText ) : boolean Check if the hasReasonPhrase exists in a collection.
hasStatusCode ( integer $statusCode ) : boolean Check if the code exists in a collection.
mergeHttpStatus ( integer $code, string $text ) Add or Update the HTTP Status array.

Protected Methods

Method Description
fetchStatusCode ( string $text ) : mixed Fetch the status code for a given reason phrase.
filterCollection ( Traversable | array $collection ) : Traversable | array Filter a Collection array.
filterReasonPhrase ( string $text ) : string Filter a Reason Phrase.
filterStatusCode ( integer $code ) : integer Filter a HTTP Status code.

Method Details

__construct() public method

Create a new Httpstatus Instance.
public __construct ( Traversable | array $statusArray = [] )
$statusArray Traversable | array a collection of HTTP status code and their associated reason phrase

count() public method

public count ( )

fetchStatusCode() protected method

Fetch the status code for a given reason phrase.
protected fetchStatusCode ( string $text ) : mixed
$text string the reason phrase
return mixed

filterCollection() protected method

Filter a Collection array.
protected filterCollection ( Traversable | array $collection ) : Traversable | array
$collection Traversable | array
return Traversable | array

filterReasonPhrase() protected method

Filter a Reason Phrase.
See also: http://tools.ietf.org/html/rfc2616#section-6.1.1
protected filterReasonPhrase ( string $text ) : string
$text string
return string

filterStatusCode() protected method

Filter a HTTP Status code.
protected filterStatusCode ( integer $code ) : integer
$code integer
return integer

getIterator() public method

public getIterator ( )

getReasonPhrase() public method

Get the text for a given status code.
public getReasonPhrase ( string $statusCode ) : string
$statusCode string http status code
return string Returns text for the given status code

getResponseClass() public method

See the CLASS_ constants for possible return values
public getResponseClass ( integer $statusCode ) : integer
$statusCode integer
return integer

getStatusCode() public method

Get the code for a given status text.
public getStatusCode ( string $statusText ) : string
$statusText string http status text
return string Returns code for the given status text

hasReasonPhrase() public method

Check if the hasReasonPhrase exists in a collection.
public hasReasonPhrase ( integer $statusText ) : boolean
$statusText integer http status text
return boolean true|false

hasStatusCode() public method

Check if the code exists in a collection.
public hasStatusCode ( integer $statusCode ) : boolean
$statusCode integer http status code
return boolean true|false

mergeHttpStatus() public method

Add or Update the HTTP Status array.
public mergeHttpStatus ( integer $code, string $text )
$code integer a HTTP status Code
$text string a associated reason phrase

Property Details

$httpStatus protected_oe property

protected $httpStatus