PHP Class Httpful\Response

Author: Nate Good ([email protected])
Show file Open project: nategood/httpful Class Usage Examples

Public Properties

Property Type Description
$body
$charset
$code
$content_type
$headers
$is_mime_personal
$is_mime_vendor_specific
$meta_data
$parent_type
$raw_body
$raw_headers
$request

Public Methods

Method Description
__construct ( string $body, string $headers, httpful\Request $request, array $meta_data = [] )
__toString ( ) : string
_interpretHeaders ( ) After we've parse the headers, let's clean things up a bit and treat some headers specially
_parse ( $body ) : array | string | object Parse the response into a clean data structure (most often an associative array) based on the expected Mime type.
_parseCode ( $headers )
_parseHeaders ( string $headers ) : array Parse text headers from response into array of key value pairs
hasBody ( ) : boolean
hasErrors ( ) : boolean Status Code Definitions

Method Details

__construct() public method

public __construct ( string $body, string $headers, httpful\Request $request, array $meta_data = [] )
$body string
$headers string
$request httpful\Request
$meta_data array

__toString() public method

public __toString ( ) : string
return string

_interpretHeaders() public method

After we've parse the headers, let's clean things up a bit and treat some headers specially
public _interpretHeaders ( )

_parse() public method

Parse the response into a clean data structure (most often an associative array) based on the expected Mime type.
public _parse ( $body ) : array | string | object
return array | string | object the response parse accordingly

_parseCode() public method

public _parseCode ( $headers )

_parseHeaders() public method

Parse text headers from response into array of key value pairs
public _parseHeaders ( string $headers ) : array
$headers string raw headers
return array parse headers

hasBody() public method

public hasBody ( ) : boolean
return boolean

hasErrors() public method

Informational 1xx Successful 2xx Redirection 3xx Client Error 4xx Server Error 5xx http://pretty-rfc.herokuapp.com/RFC2616#status.codes
public hasErrors ( ) : boolean
return boolean Did we receive a 4xx or 5xx?

Property Details

$body public property

public $body

$charset public property

public $charset

$code public property

public $code

$content_type public property

public $content_type

$headers public property

public $headers

$is_mime_personal public property

public $is_mime_personal

$is_mime_vendor_specific public property

public $is_mime_vendor_specific

$meta_data public property

public $meta_data

$parent_type public property

public $parent_type

$raw_body public property

public $raw_body

$raw_headers public property

public $raw_headers

$request public property

public $request