ApiResponse
in package
FIXME Support streams
Tags
Table of Contents
Properties
- $_jsonAsArray : array<string|int, mixed>
- $_jsonAsObject : stdClass
- $_multiparts : array<string|int, ApiResponse>
- $_request : RequestInterface
- $_response : ResponseInterface
Methods
- __construct() : mixed
- TODO Support strams
- body() : StreamInterface
- createResponse() : mixed
- error() : string
- Returns a meaningful error message
- json() : stdClass
- Parses response body as JSON Result is cached internally
- jsonArray() : array<string|int, mixed>
- Parses response body as JSON and returns an array Result is cached internally
- multipart() : array<string|int, ApiResponse>
- Parses multipart response body as an array of ApiResponse objects
- ok() : bool
- raw() : mixed
- request() : RequestInterface
- response() : ResponseInterface
- text() : string
- getContentType() : mixed
- isContentType() : mixed
Properties
$_jsonAsArray
protected
array<string|int, mixed>
$_jsonAsArray
$_jsonAsObject
protected
stdClass
$_jsonAsObject
$_multiparts
protected
array<string|int, ApiResponse>
$_multiparts
$_request
protected
RequestInterface
$_request
$_response
protected
ResponseInterface
$_response
Methods
__construct()
TODO Support strams
public
__construct([RequestInterface $request = null ][, ResponseInterface $response = null ]) : mixed
Parameters
- $request : RequestInterface = null
-
Reqeuest used to get the response
- $response : ResponseInterface = null
-
Response
body()
public
body() : StreamInterface
Return values
StreamInterfacecreateResponse()
public
static createResponse([mixed $body = '' ][, mixed $status = 200 ]) : mixed
Parameters
- $body : mixed = ''
- $status : mixed = 200
error()
Returns a meaningful error message
public
error() : string
Return values
stringjson()
Parses response body as JSON Result is cached internally
public
json() : stdClass
Tags
Return values
stdClassjsonArray()
Parses response body as JSON and returns an array Result is cached internally
public
jsonArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>multipart()
Parses multipart response body as an array of ApiResponse objects
public
multipart() : array<string|int, ApiResponse>
Tags
Return values
array<string|int, ApiResponse>ok()
public
ok() : bool
Return values
boolraw()
public
raw() : mixed
request()
public
request() : RequestInterface
Return values
RequestInterfaceresponse()
public
response() : ResponseInterface
Return values
ResponseInterfacetext()
public
text() : string
Return values
stringgetContentType()
protected
getContentType() : mixed
isContentType()
protected
isContentType(mixed $type) : mixed
Parameters
- $type : mixed