Response
Table of Contents
- BINARY_TYPES = ['application/pdf']
- $_headers : mixed
- $_request : mixed
- $_response : mixed
- $_status_code : mixed
- __construct() : mixed
- Constructor
- getContentType() : string
- Getter method for the Content-Type HTTP response header
- getHeaders() : array<string|int, mixed>
- Getter method for all of the HTTP headers included with the response.
- getJsonResponse() : object
- Decodes and returns the raw response as JSON
- getRateLimit() : string
- Getter method for the X-RateLimit-Limit HTTP response header
- getRateLimitRemaining() : string
- Getter method for the X-RateLimit-Remaining HTTP response header
- getRateLimitReset() : string
- Getter method for the X-RateLimit-Reset HTTP response header
- getRawResponse() : string
- The raw string response from the API server.
- getRecordCount() : string
- Getter method for the Recurly-Total-Records HTTP response header
- getRequest() : Request
- The \Recurly\Request object
- getRequestId() : string
- Getter method for the X-Request-Id HTTP response header
- getStatusCode() : int
- Getter method for the HTTP status code
- setHeaders() : void
- Parses the HTTP response headers. If the $headers param is null then a 400 Bad Request is assumed.
- toResource() : RecurlyResource
- Converts the Response into a \Recurly\RecurlyResource
- _getHeaderValue() : string
- Generic getter method for the HTTP response headers
Constants
BINARY_TYPES
private
mixed
BINARY_TYPES
= ['application/pdf']
Properties
$_headers
private
mixed
$_headers
= []
$_request
private
mixed
$_request
$_response
private
mixed
$_response
$_status_code
private
mixed
$_status_code
Methods
__construct()
Constructor
public
__construct(string $response, Request $request) : mixed
Parameters
- $response : string
-
The raw HTTP response string
- $request : Request
Return values
mixed —getContentType()
Getter method for the Content-Type HTTP response header
public
getContentType() : string
Return values
string —The Content-Type header value
getHeaders()
Getter method for all of the HTTP headers included with the response.
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —Associative array of response headers
getJsonResponse()
Decodes and returns the raw response as JSON
public
getJsonResponse() : object
Return values
object —Parsed JSON body
getRateLimit()
Getter method for the X-RateLimit-Limit HTTP response header
public
getRateLimit() : string
Return values
string —The X-RateLimit-Limit header value
getRateLimitRemaining()
Getter method for the X-RateLimit-Remaining HTTP response header
public
getRateLimitRemaining() : string
Return values
string —The X-RateLimit-Remaining header value
getRateLimitReset()
Getter method for the X-RateLimit-Reset HTTP response header
public
getRateLimitReset() : string
Return values
string —The X-RateLimit-Reset header value
getRawResponse()
The raw string response from the API server.
public
getRawResponse() : string
Return values
string —getRecordCount()
Getter method for the Recurly-Total-Records HTTP response header
public
getRecordCount() : string
Return values
string —The Recurly-Total-Records header value
getRequest()
The \Recurly\Request object
public
getRequest() : Request
Return values
Request —getRequestId()
Getter method for the X-Request-Id HTTP response header
public
getRequestId() : string
Return values
string —The X-Request-Id header value
getStatusCode()
Getter method for the HTTP status code
public
getStatusCode() : int
Return values
int —The HTTP status code
setHeaders()
Parses the HTTP response headers. If the $headers param is null then a 400 Bad Request is assumed.
public
setHeaders(array<string|int, mixed> $headers) : void
Parameters
- $headers : array<string|int, mixed>
-
An array of HTTP response headers
Return values
void —toResource()
Converts the Response into a \Recurly\RecurlyResource
public
toResource() : RecurlyResource
Return values
RecurlyResource —_getHeaderValue()
Generic getter method for the HTTP response headers
private
_getHeaderValue(string $key[, string $default = '' ]) : string
Parameters
- $key : string
-
The header name to lookup
- $default : string = ''
-
(optional) The value to return if the header is not set
Return values
string —The header value or an empty string if the header is not set