Rest
in package
The rest class is used to provide raw JSON API data to the client
Table of Contents
- $data : object
- $json : string
- __construct() : mixed
- Creates a rest object
- execute() : mixed
- Sends the rest stuff to the client
- ShowError() : mixed
- Sends an error to the client
Properties
$data
private
object
$data
Payload of the rest
$json
private
string
$json
The payload formatted as json
Methods
__construct()
Creates a rest object
public
__construct(array<string|int, mixed> $data, array<string|int, string> $urlParts) : mixed
Parameters
- $data : array<string|int, mixed>
-
Data should be send.
- $urlParts : array<string|int, string>
-
to which the request was targeted at
Return values
mixed —execute()
Sends the rest stuff to the client
public
execute([bool $die = true ]) : mixed
Parameters
- $die : bool = true
-
Should the program end after sending?
Return values
mixed —ShowError()
Sends an error to the client
public
ShowError(string $code, string $message) : mixed
Parameters
- $code : string
-
The error code
- $message : string
-
A human readable message, explaning the error