/** * Returns a standardised 500 error. * * To be used in the event of a catastrophic failure, this method creates * all new objects, ignoring dependency injection and returns in JSON. * * This will be problematic for users expecting a response in a format * other than JSON and should only be called if the format they are * actually expecting can not be provided when using * Response::prepareResponse. * * @return Response */ protected function createFailSafeResponse() { $status = new Status(500); $response = new Response(); $response->setRequest(new Request()); $response->setWriter(new Json()); $response->setStatus($status); $response->setBodyData($status->getMessage()); return $response; }