Documentation

Response
in package

A generic response as received from an API call. Contains the status code, body, and parsed JSON (if any).

Table of Contents

$body  : string|null
The raw body received from the API.
$headers  : string|null
The headers for the response, if any.
$headerSize  : int|null
The header size for the response, if any.
$info  : array<string|int, mixed>|null
The information for the response, if any.
$request  : Request|null
$result  : string|null
The raw result for the response, if any.
$statusCode  : int|null
The HTTP status code for the response, if any.
$url  : string|null
The url of calling this API.
__construct()  : mixed
Constructing a Response
__toString()  : string
getBody()  : string|null
getBodyAsJsonObject()  : object
getData()  : array<string|int, mixed>|null|object
getHeaders()  : string|null
getHeadersAsArray()  : array<string|int, mixed>|null
getHeaderSize()  : int|mixed|null
getInfo()  : array<string|int, mixed>|null
getMeta()  : object|null
getRequest()  : Request|null
getResult()  : string|null
getStatusCode()  : int|null
getUrl()  : string|null
headersToArray()  : array<string|int, mixed>
Convert the output header to array

Properties

$body

The raw body received from the API.

private string|null $body = null

$headers

The headers for the response, if any.

private string|null $headers = null

$headerSize

The header size for the response, if any.

private int|null $headerSize = null

$info

The information for the response, if any.

private array<string|int, mixed>|null $info = null

$result

The raw result for the response, if any.

private string|null $result = null

$statusCode

The HTTP status code for the response, if any.

private int|null $statusCode = null

$url

The url of calling this API.

private string|null $url = null

Methods

__construct()

Constructing a Response

public __construct(Request|null $request, array<string|int, mixed>|null $info, string|null $result) : mixed
Parameters
$request : Request|null
$info : array<string|int, mixed>|null
$result : string|null
Return values
mixed

__toString()

public __toString() : string
Return values
string

getBody()

public getBody() : string|null
Return values
string|null

getBodyAsJsonObject()

public getBodyAsJsonObject() : object
Return values
object

getData()

public getData() : array<string|int, mixed>|null|object
Return values
array<string|int, mixed>|null|object

getHeaders()

public getHeaders() : string|null
Return values
string|null

getHeadersAsArray()

public getHeadersAsArray() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getHeaderSize()

public getHeaderSize() : int|mixed|null
Return values
int|mixed|null

getInfo()

public getInfo() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getMeta()

public getMeta() : object|null
Return values
object|null

getResult()

public getResult() : string|null
Return values
string|null

getStatusCode()

public getStatusCode() : int|null
Return values
int|null

getUrl()

public getUrl() : string|null
Return values
string|null

headersToArray()

Convert the output header to array

public headersToArray(string $str) : array<string|int, mixed>
Parameters
$str : string
Return values
array<string|int, mixed>

Search results