CWIS Developer Documentation
|
Convenience class for standardizing JSON responses, making it easier to export primitive data types to JSON format, and printing JSON responses. More...
Public Member Functions | |
__construct () | |
Object constructor. More... | |
AddDatum ($Key, $Value) | |
Add a datum identified by a key to export in the JSON response. More... | |
AddWarning ($Message) | |
Add a warning message to export in the JSON response. More... | |
Error ($Message) | |
Add an error message to export in the JSON response and then send the response. More... | |
Success ($Message="") | |
Signal that the callback was successful and optionally set a message. More... | |
Convenience class for standardizing JSON responses, making it easier to export primitive data types to JSON format, and printing JSON responses.
Definition at line 14 of file JsonHelper.php.
JsonHelper::__construct | ( | ) |
Object constructor.
Definition at line 20 of file JsonHelper.php.
JsonHelper::AddDatum | ( | $Key, | |
$Value | |||
) |
Add a datum identified by a key to export in the JSON response.
string | $Key | Key used to identify the datum. |
mixed | $Value | Datum to export. |
Definition at line 31 of file JsonHelper.php.
JsonHelper::AddWarning | ( | $Message | ) |
Add a warning message to export in the JSON response.
Warnings are for issues that might be problematic but won't interrupt execution.
string | $Message | Warning message to export. |
Definition at line 43 of file JsonHelper.php.
JsonHelper::Error | ( | $Message | ) |
Add an error message to export in the JSON response and then send the response.
A possible use of this method is to output and export a message about a missing parameter to a callback.
string | $Message | Error message to send. |
Definition at line 55 of file JsonHelper.php.
JsonHelper::Success | ( | $Message = "" | ) |
Signal that the callback was successful and optionally set a message.
string | $Message | Message to export. This parameter is optional. |
Definition at line 65 of file JsonHelper.php.