\AdventureRes\Http AdventureResResponse

Class AdventureResResponse

Summary

Methods
Properties
Constants
__call()
__construct()
getRequest()
getHttpStatusCode()
getHeaders()
getBody()
getDecodedBody()
isError()
throwException()
makeException()
getThrownException()
decodeBody()
No public properties found
No constants found
No protected methods found
$httpStatusCode
$headers
$body
$decodedBody
$request
$thrownException
N/A
extractHeaders()
No private properties found
N/A

Properties

$httpStatusCode

$httpStatusCode : integer

Type

integer — The HTTP status code response from the API request.

$headers

$headers : array

Type

array — The headers returned from the API request.

$body

$body : string

Type

string — The raw body of the response from the API request.

$decodedBody

$decodedBody : array

Type

array — The decoded body of the API response.

Methods

__call()

__call(  $command,   $arguments) 

Parameters

$command
$arguments

__construct()

__construct(\AdventureRes\Http\AdventureResRequest  $request, string|null  $body = null, integer|null  $httpStatusCode = null, string|null  $headers = null) 

Creates a new Response entity.

Parameters

\AdventureRes\Http\AdventureResRequest $request
string|null $body
integer|null $httpStatusCode
string|null $headers

getHttpStatusCode()

getHttpStatusCode() : integer

Return the HTTP status code for this response.

Returns

integer

getHeaders()

getHeaders() : array

Return the HTTP headers for this response.

Returns

array

getBody()

getBody() : string

Return the raw body response.

Returns

string

getDecodedBody()

getDecodedBody() : array

Return the decoded body response.

Returns

array

isError()

isError() : boolean

Returns true if the API returned an error message.

Returns

boolean

throwException()

throwException() 

Throws the exception.

Throws

\AdventureRes\Exceptions\AdventureResResponseException

makeException()

makeException() 

Instantiates an exception to be thrown later.

decodeBody()

decodeBody() : mixed

Formats the response body into a usable format.

Returns

mixed

extractHeaders()

extractHeaders(string  $rawHeaders) 

Converts raw headers to an array.

Parameters

string $rawHeaders