protected function calories() { if (!$this->session->status()) { return $this->_response("Authentication Required", 401); } $calories = new Calories(); if ($this->method == 'GET') { return $calories->getList(); } else { if ($this->method == 'POST') { if ($this->data) { return $calories->addEntry($this->data); } } else { if ($this->method == 'DELETE') { if ($this->id) { return $calories->deleteById($this->id); } } } } return ""; }