public function get() { try { return JsonResponse::ok(array('color' => $this->getColor(), 'days' => $this->getDays(), 'temp' => intval(round($this->getTemp())), 'time' => time(), 'offset' => date('Z'))); } catch (Exception $e) { return JsonResponse::error(array('error' => $e->getMessage())); } }
public function post() { try { $temp = strtolower(trim($this->request->getPost('data'))); $this->setTemp($temp); return JsonResponse::ok(array('temp' => $this->getTemp())); } catch (Exception $e) { return JsonResponse::error(array('error' => $e->getMessage())); } }