HttpStatus

HTTP status code and message translator

package Klein

 Methods

Constructor

__construct(int $code, string $message) : void
access public

Parameters

$code

int

The HTTP code

$message

string

(optional) HTTP message for the corresponding code

Magic "__toString" method

__toString() : string

Allows the ability to arbitrarily use an instance of this class as a string This method will be automatically called, returning a string representation of this instance

access public

Returns

string

Get the HTTP status code

getCode() : int
access public

Returns

int

Get a string representation of our HTTP status

getFormattedString() : string
access public

Returns

string

Get the HTTP status message

getMessage() : string
access public

Returns

string

Get our HTTP 1.1 message from our passed code

getMessageFromCode(int $int) : string
Static

Returns null if no corresponding message was found for the passed in code

static
access public

Parameters

$int

int

Returns

string| null

Set the HTTP status code

setCode(int $code) : \Klein\HttpStatus
access public

Parameters

$code

int

Returns

Set the HTTP status message

setMessage(string $message) : \Klein\HttpStatus
access public

Parameters

$message

string

Returns

 Properties

 

$code : int
access protected
 

$http_messages : array
 

$message : string
access protected