public static function renderError($type, $message, $file, $line) { if (empty(self::$views['error'])) { return null; } $data = self::details($message, $file, $line); if (!headers_sent() && Request::is('xhr')) { ob_start(); self::unregister(); Response::cache(0); Response::type('application/json'); echo json_encode($data); App::abort(500); } View::render(self::$views['error'], $data); }