Authored by Vlastimil Pospíchal

JSON serializer


class Handler implements JsonSerializable {
    private $data;
    private $status;
    private $message;

    public function __construct(array $data, $status="OK", $message="") {
        $this->data = $data;
        $this->status = $status;
        $this->message = $message;

    function jsonSerialize() {
        return array(
            'result' => $this->status,
            'message' => $this->message,
            'data' => $this->data,
            'sync_date' => strtotime("now"),
11 Bytes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment