Response
in package
Tags
Table of Contents
- $apiError : ApiError|int
- $body : array<string|int, mixed>
- $data : array<string|int, mixed>|null
- $headers : array<string|int, mixed>
- $httpCode : int
- $message : string
- $status : ApiStatus
- $apiError : ApiError
- The api error
- $body : string
- The response body
- $headers : string
- The response headers
- $httpCode : int
- The response http code
- $message : string
- The interface message
- $response : ResponseInterface
- PSR response
- $status : ApiStatus
- The response status
- __construct() : mixed
- Response
- __get() : mixed|null
- Generic accessor
- checkVersion() : void
- This checks if the crm version is way far beyond the client version.
- tryDecodeJson() : array<string|int, mixed>|false
- Try to decode json and return false if it is not a valid json
Properties
$apiError
public
ApiError|int
$apiError
The api error status it there is any
$body
public
array<string|int, mixed>
$body
The http response body, this is parsed json
$data
public
array<string|int, mixed>|null
$data
The reponse data
$headers
public
array<string|int, mixed>
$headers
The http reponse headers
$httpCode
public
int
$httpCode
The http response code
$message
public
string
$message
The api message
$status
public
ApiStatus
$status
The response api status
$apiError
The api error
private
ApiError
$apiError
$body
The response body
private
string
$body
$headers
The response headers
private
string
$headers
$httpCode
The response http code
private
int
$httpCode
= 0
$message
The interface message
private
string
$message
$response
PSR response
private
ResponseInterface
$response
$status
The response status
private
ApiStatus
$status
Methods
__construct()
Response
public
__construct(ApiStatus $status, ResponseInterface $response) : mixed
Parameters
- $status : ApiStatus
- $response : ResponseInterface
Tags
Return values
mixed —__get()
Generic accessor
public
__get(string $field) : mixed|null
Parameters
- $field : string
Return values
mixed|null —checkVersion()
This checks if the crm version is way far beyond the client version.
private
checkVersion(string $version) : void
If a minor version mismatch is detected we will log this as a warning. If a major version mismatch is detected we will throw a CrmException as there shall be an incompatibility with the response.
The goal here is to force clients to be up to date. A major version change means breaking change.
Parameters
- $version : string
Tags
Return values
void —tryDecodeJson()
Try to decode json and return false if it is not a valid json
private
tryDecodeJson(string $string) : array<string|int, mixed>|false
Parameters
- $string : string
Return values
array<string|int, mixed>|false —Returns an associative data array or false if failed to parse.