public static function sendResponse($nameOrStatus, $data = []) { $type = Request::guessResponseType(); $template = Template::find($nameOrStatus, $type); $status = is_numeric($nameOrStatus) ? $nameOrStatus : static::HTTP_200; static::setStatus($status); static::setContentType($type); if ($type == static::HTML) { Template::setDecorator('baseHtml'); } $data['_status'] = $status; static::setContent(Template::renderPage($template, $data)); static::send(); }