tvheadend/vendor/ext-3.4.1/examples/restful/remote/lib/response.php
Adam Sutton bafcfff42d webui: restructure webui/extjs source files
I want to keep the 3rd-party packages away from the main source
where possible.
2013-06-03 17:11:01 +01:00

22 lines
661 B
PHP

<?php
/**
* @class Response
* A simple JSON Response class.
*/
class Response {
public $success, $data, $message, $errors, $tid, $trace;
public function __construct($params = array()) {
$this->success = isset($params["success"]) ? $params["success"] : false;
$this->message = isset($params["message"]) ? $params["message"] : '';
$this->data = isset($params["data"]) ? $params["data"] : array();
}
public function to_json() {
return json_encode(array(
'success' => $this->success,
'message' => $this->message,
'data' => $this->data
));
}
}