json Class Reference
Quickly kill request while serving it(s content) as JSON.
More...
Static Public Member Functions |
static | fail ($reason=null, $http_status_code=500) |
| Give it anything, it will turn it into JSON.
|
static | fail_view ($reason) |
| Contrary to json::fail(), this method will not exit() but rather return a prepared special View for you.
|
static | ok ($result=null, $http_status_code=200) |
| Give it anything, it will turn it into JSON.
|
static | ok_view ($result) |
| Contrary to json::ok(), this method will not exit() but rather return a prepared special View for you.
|
static | pretty ($data, $indent=0) |
| Serialize JSON data in pretty-printed form, in PHP < 5.4 compatible way.
|
Detailed Description
Quickly kill request while serving it(s content) as JSON.
Member Function Documentation
static json::fail |
( |
$ |
reason = null , |
|
|
$ |
http_status_code = 500 | |
|
) |
| | [static] |
Give it anything, it will turn it into JSON.
- Parameters:
-
| $reason | string |
| $http_status_code | int = 500 |
static json::fail_view |
( |
$ |
reason |
) |
[static] |
Contrary to json::fail(), this method will not exit() but rather return a prepared special View for you.
This makes testing the result of a controller's method possible.
- Parameters:
-
- Returns:
- View
static json::ok |
( |
$ |
result = null , |
|
|
$ |
http_status_code = 200 | |
|
) |
| | [static] |
Give it anything, it will turn it into JSON.
- Parameters:
-
| $result | string |
| $http_status_code | int = 200 |
static json::ok_view |
( |
$ |
result |
) |
[static] |
Contrary to json::ok(), this method will not exit() but rather return a prepared special View for you.
This makes testing the result of a controller's method possible.
- Parameters:
-
- Returns:
- View
static json::pretty |
( |
$ |
data, |
|
|
$ |
indent = 0 | |
|
) |
| | [static] |
Serialize JSON data in pretty-printed form, in PHP < 5.4 compatible way.
- Parameters:
-
| $data | mixed The object to serialize |
| $indent | int Width of the indentation |
- Returns:
- string A plain-text, pretty-printed json representation of $data
The documentation for this class was generated from the following file: