From 03862ad43c76aa99aa55f56c62f28e2497338252 Mon Sep 17 00:00:00 2001 From: Ilya Bakhlin Date: Sat, 8 Jan 2022 23:53:37 +0100 Subject: [PATCH] Simplifying the Bootstrap class. --- chandler/Bootstrap.php | 50 ++++++++---------------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/chandler/Bootstrap.php b/chandler/Bootstrap.php index 97333f0..1b05eb0 100644 --- a/chandler/Bootstrap.php +++ b/chandler/Bootstrap.php @@ -4,53 +4,21 @@ declare(strict_types = 1); use Chandler\MVC\Routing\Router; -/** - * Bootstrap class, that is called during framework starting phase. - * Initializes everything. - * - * @author kurotsun - * @internal - */ class Bootstrap { - /** - * Bootstraps extensions. - * - * @return void - * @internal - */ - private function igniteExtensions(): void - { - Chandler\Extensions\ExtensionManager::getInstance(); - } - - /** - * Starts router and serves request. - * - * @param string $url Request URL - * - * @return void - * @internal - */ - private function route(string $url): void - { - ob_start(); - if (($output = Router::getInstance()->execute($url)) !== null) - echo $output; - else - chandler_http_panic(404, "Not Found", "No routes for $url."); - ob_flush(); - ob_end_flush(); - flush(); - } - /** * @return void */ public function ignite(): void { - $this->igniteExtensions(); - header("Referrer-Policy: strict-origin-when-cross-origin"); - $this->route($_SERVER["REQUEST_URI"]); + Chandler\Extensions\ExtensionManager::getInstance(); + ob_start(); + if (($output = Router::getInstance()->execute($_SERVER["REQUEST_URI"])) !== null) + echo $output; + else + chandler_http_panic(404, "Not Found", "No routes for {$_SERVER["REQUEST_URI"]}."); + ob_flush(); + ob_end_flush(); + flush(); } }