\VivialConnect\CommonResponse

Summary

Methods
Properties
Constants
__construct()
getStatusCode()
setStatusCode()
getStatusPhrase()
getHeaders()
getHeader()
setHeader()
setHeaders()
getBody()
setBody()
getPayload()
isThrowable()
parse()
isSuccessful()
No public properties found
No constants found
No protected methods found
$statusCode
$headers
$throwable
$body
$payload
$statusTexts
N/A
No private methods found
No private properties found
N/A

Properties

$statusCode

$statusCode : integer

HTTP response code

Type

integer

$headers

$headers : array

Array of response headers

Type

array

$throwable

$throwable : array

Array of HTTP response codes that Resource should throw an exception when encountering

Type

array

$body

$body : 

Raw response body

Type

$payload

$payload : mixed

The fully parsed/decoded payload

Type

mixed

$statusTexts

$statusTexts : array

Type

array

Methods

__construct()

__construct(\Psr\Http\Message\ResponseInterface  $response = null) 

Response constructor.

Parameters

\Psr\Http\Message\ResponseInterface $response

getStatusCode()

getStatusCode() : integer

Get the response status code

Returns

integer

setStatusCode()

setStatusCode(  $statusCode) 

Parameters

$statusCode

getStatusPhrase()

getStatusPhrase() : string

Get the response status code

Returns

string

getHeaders()

getHeaders() : mixed

Get all headers

Returns

mixed

getHeader()

getHeader(  $name) : string|null

Get a specific header

Parameters

$name

Returns

string|null

setHeader()

setHeader(  $header,   $value) 

Parameters

$header
$value

setHeaders()

setHeaders(array  $headers) 

Parameters

array $headers

getBody()

getBody() : string

Get the raw (pre-parsed/decoded) response body

Returns

string

setBody()

setBody(  $body) 

Set the raw response body and trigger the parser to update the payload

Parameters

$body

getPayload()

getPayload() : mixed

Get the parsed/decoded response payload

Returns

mixed

isThrowable()

isThrowable() : boolean

Is this response a throwable error

Returns

boolean

parse()

parse(string  $body) : mixed

Parse/decode the response body for processing

Parameters

string $body

Returns

mixed

isSuccessful()

isSuccessful() : boolean

Whether this request was successful or not

Returns

boolean