/** * Add currently built result to the response object. * * @param $code */ private function addToResponse($code) { $this->response->setStatusCode($code); $this->response->setData($this->result); }
/** * Intercepts data to be set to JSON and includes additional information. * * @param mixed $data * @return JsonResponse * @throws \InvalidArgumentException */ public function setData($data = array()) { $fullData = $this->siblingContent; $fullData['data'] = $data; return parent::setData($fullData); }
/** * @param array $data * @return JsonResponse */ public function setData($data = []) { $resp = ['status' => $this->getStatusCode() == 200 ? 'success' : 'error', 'statusCode' => $this->getStatusCode()]; return parent::setData(array_merge($data, $resp)); }