PHP Class Httpful\Response

Author: Nate Good ([email protected])
显示文件 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_oe property

public $body

$charset public_oe property

public $charset

$code public_oe property

public $code

$content_type public_oe property

public $content_type

$headers public_oe property

public $headers

$is_mime_personal public_oe property

public $is_mime_personal

$is_mime_vendor_specific public_oe property

public $is_mime_vendor_specific

$meta_data public_oe property

public $meta_data

$parent_type public_oe property

public $parent_type

$raw_body public_oe property

public $raw_body

$raw_headers public_oe property

public $raw_headers

$request public_oe property

public $request