This repository has been archived on 2021-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
TaskBoard/api/jsonResponse.php
2014-10-10 10:35:43 -04:00

22 lines
449 B
PHP

<?php
// Provides default structure and JSON encoded response for the API.
class JsonResponse {
var $message;
var $data;
var $alerts;
function asJson() {
return json_encode($this);
}
function addBeans($beans) {
if (null == $beans) return array();
$this->data = R::exportAll($beans);
}
function addAlert($type, $text) {
$this->alerts[] = ['type' => $type, 'text' => $text];
}
}