/** * @param Exception $exception * @return mixed */ public function handle(Exception $exception) { if ($this->isDebugMode()) { $response = $this->prepareDebugResponse($exception); } else { $response = $this->preparePlainResponse($exception); } if (can_send_headers()) { header('Content-Type: text/plain'); } echo $response; return Handler::QUIT; }
/** * @param Exception $exception * @return mixed */ public function handle(Exception $exception) { if ($this->isOnlyForAjax() && !$this->isAjaxRequest()) { return Handler::DONE; } if ($this->isDebugMode()) { $response = $this->prepareDebugResponse($exception); } else { $response = $this->preparePlainResponse($exception); } if (can_send_headers()) { header('Content-Type: application/json'); } echo json_encode($response); return Handler::QUIT; }
/** * Sends the response, writes output * * @param $response */ protected function writeOutput($response) { $this->clearOutput(); // We are not using 5.3 mess here since this package requires php >= 5.4.0 // http://php.net/manual/tr/function.http-response-code.php if (can_send_headers()) { http_response_code($this->sendHttpCode()); } echo $response; }