Output
class Output
Represents the output to be shown to the user
Output consists of a success/failure flag, an HTTP response code, and a response body. The response body can be anything that is JSON encodable.
Properties
| private | $ok | ||
| private | $code | ||
| private | $message | ||
| private | $appdata | ||
| private | $metrics | ||
| private | $debug |
Methods
Returns whether or not the request succeeded
Returns the response code for the request
Returns the error message string (only if not isOK)
Returns the response body to be returned (only if isOK)
Sets performance metrics to be returned
Returns the Output object as a client array
Returns the appdata as a single string (or null if not possible)
No description
Constructs an Output object representing a client error, showing the exception and possibly extra debug
Constructs an Output object representing a non-client error, possibly with debug
Parses a response from a remote Andromeda API request into an Output object
Details
at line 25
bool
isOK()
Returns whether or not the request succeeded
at line 28
int
GetCode()
Returns the response code for the request
at line 31
string
GetMessage()
Returns the error message string (only if not isOK)
at line 34
GetAppdata()
Returns the response body to be returned (only if isOK)
at line 37
Output
SetMetrics(array|null $metrics)
Sets performance metrics to be returned
at line 44
array
GetAsArray()
Returns the Output object as a client array
at line 59
string|null
GetAsString()
Returns the appdata as a single string (or null if not possible)
at line 78
private
__construct(bool $ok = true, int $code = 200)
No description
at line 84
static Output
Success(array $appdata)
Constructs an Output object representing a success response
at line 93
static Output
ClientException(ClientException $e, array|null $debug = null)
Constructs an Output object representing a client error, showing the exception and possibly extra debug
at line 105
static Output
Exception(array|null $debug = null)
Constructs an Output object representing a non-client error, possibly with debug
at line 122
static Output
ParseArray(array $data)
Parses a response from a remote Andromeda API request into an Output object