/** * Forces a HTTP error page to be displayed. This does not stop script execution, but prevents further output. * * @author Art <*****@*****.**> * * @param int $code The HTTP response code */ protected function httpError($code = 404) { $this->echoOnDestruct = true; ob_clean(); $controller = Alo::$router->getErrController(); $controllerNamespaced = '\\Controller\\' . $controller; Alo::includeonceifexists(DIR_APP . 'controllers' . DIRECTORY_SEPARATOR . strtolower($controller) . '.php'); if (!class_exists($controllerNamespaced, true)) { http_response_code((int) $code); echo 'HTTP ' . Security::unXss($code) . '.'; } else { Alo::$controller = new $controllerNamespaced(); /** @noinspection PhpUndefinedMethodInspection */ Alo::$controller->error($code); ob_flush(); $this->echoOnDestruct = false; } }