PHP Class Phergie_Plugin_Http_Response, phergie

Author: Phergie Development Team ([email protected])
Exibir arquivo Open project: phergie/phergie Class Usage Examples

Protected Properties

Property Type Description
$code string HTTP response code or 0 if no HTTP response was received
$codeStrings array HTTP response strings
$content mixed Content of the response body, decoded for supported content types
$headers array Associative array mapping response header names to their values
$message string Description of the HTTP response code or the error message if no HTTP response was received
$meta array Associative array containing other metadata about the response

Public Methods

Method Description
getCode ( ) : string Returns the HTTP response code.
getCodeAsString ( ) : string Returns the HTTP response code text.
getContent ( ) : mixed Returns the content of the response body.
getHeaders ( string $name = null ) : array | string Returns all response headers or the value of a single specified response header.
getMessage ( ) : string Returns the HTTP response description.
getMeta ( string $name = null ) : array | string | null Returns all metadata or the value of a single specified metadatum.
isError ( ) : boolean Returns whether the response indicates a client- or server-side error.
setCode ( string $code ) : Phergie_Plugin_Http_Response Sets the HTTP response code.
setContent ( mixed $content ) : Phergie_Plugin_Http_Response Sets the content of the response body.
setHeaders ( array $headers ) : Phergie_Plugin_Http_Response Sets the response headers.
setMessage ( string $message ) : Phergie_Plugin_Http_Response Sets the HTTP response description.
setMeta ( array $meta ) : Phergie_Plugin_Http_Response Sets the response metadata.

Method Details

getCode() public method

Returns the HTTP response code.
public getCode ( ) : string
return string Response code

getCodeAsString() public method

Returns the HTTP response code text.
public getCodeAsString ( ) : string
return string Response code text

getContent() public method

Returns the content of the response body.
public getContent ( ) : mixed
return mixed Response body content, decoded for supported content types

getHeaders() public method

Returns all response headers or the value of a single specified response header.
public getHeaders ( string $name = null ) : array | string
$name string Optional name of a single header for which the associated value should be returned
return array | string Associative array of all header values, a string containing the value of the header indicated by $name if one is set, or null if one is not

getMessage() public method

Returns the HTTP response description.
public getMessage ( ) : string
return string

getMeta() public method

Returns all metadata or the value of a single specified metadatum.
public getMeta ( string $name = null ) : array | string | null
$name string Optional name of a single metadatum for which the associated value should be returned
return array | string | null Associative array of all metadata values, a string containing the value of the metadatum indicated by $name if one is set, or null if one is not

isError() public method

Returns whether the response indicates a client- or server-side error.
public isError ( ) : boolean
return boolean TRUE if the response indicates an error, FALSE otherwise

setCode() public method

Sets the HTTP response code.
public setCode ( string $code ) : Phergie_Plugin_Http_Response
$code string Response code
return Phergie_Plugin_Http_Response Provides a fluent interface

setContent() public method

Sets the content of the response body.
public setContent ( mixed $content ) : Phergie_Plugin_Http_Response
$content mixed Response body content
return Phergie_Plugin_Http_Response Provides a fluent interface

setHeaders() public method

Sets the response headers.
public setHeaders ( array $headers ) : Phergie_Plugin_Http_Response
$headers array Associative array of response headers indexed by header name
return Phergie_Plugin_Http_Response Provides a fluent interface

setMessage() public method

Sets the HTTP response description.
public setMessage ( string $message ) : Phergie_Plugin_Http_Response
$message string Response description
return Phergie_Plugin_Http_Response Provides a fluent interface

setMeta() public method

Sets the response metadata.
public setMeta ( array $meta ) : Phergie_Plugin_Http_Response
$meta array Associative array of response metadata
return Phergie_Plugin_Http_Response Provides a fluent interface

Property Details

$code protected_oe property

HTTP response code or 0 if no HTTP response was received
protected string $code
return string

$codeStrings protected_oe static_oe property

HTTP response strings
protected static array $codeStrings
return array

$content protected_oe property

Content of the response body, decoded for supported content types
protected mixed $content
return mixed

$headers protected_oe property

Associative array mapping response header names to their values
protected array $headers
return array

$message protected_oe property

Description of the HTTP response code or the error message if no HTTP response was received
protected string $message
return string

$meta protected_oe property

Associative array containing other metadata about the response
protected array $meta
return array