route(); } catch (HttpException $e) { Http::sendHeaderByCode($e->getCode()); die($e->getMessage()); } catch (Exception $e) { die($e->getMessage()); } exit; } public static function handleAuth($route) { if (empty($route)) return; try { $route = self::getRoute($route); $route->handleAuth(); } catch (HttpException $e) { Http::sendHeaderByCode($e->getCode()); die($e->getMessage()); } catch (Exception $e) { die($e->getMessage()); } } public static function getRoute($route) { if (empty($route)) return; $routeClassName = "Route_{$route}"; if (Lib::tryLoadClass($routeClassName)) { $route = new $routeClassName(); return $route; } else { throw new HttpException("Not found", 404); } } }