From 104416c967673dda10ae39b8529a2d5239eb8c56 Mon Sep 17 00:00:00 2001 From: Ilya Bakhlin Date: Sun, 9 Jan 2022 00:37:58 +0100 Subject: [PATCH] Removing the Bootstrap class. --- chandler/Bootstrap.php | 24 ------------------------ public/index.php | 13 +++++++++++-- 2 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 chandler/Bootstrap.php diff --git a/chandler/Bootstrap.php b/chandler/Bootstrap.php deleted file mode 100644 index 1b05eb0..0000000 --- a/chandler/Bootstrap.php +++ /dev/null @@ -1,24 +0,0 @@ -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(); - } -} diff --git a/public/index.php b/public/index.php index 2c2c953..cc40b0e 100644 --- a/public/index.php +++ b/public/index.php @@ -2,6 +2,8 @@ declare(strict_types = 1); +use Chandler\MVC\Routing\Router; + require_once(dirname(__DIR__) . "/vendor/autoload.php"); define("CHANDLER_ROOT", dirname(__DIR__)); @@ -9,6 +11,13 @@ define("CHANDLER_ROOT_CONF", yaml_parse_file(CHANDLER_ROOT . "/chandler.yml")); define("CHANDLER_EXTENSIONS_AVAILABLE", CHANDLER_ROOT . CHANDLER_ROOT_CONF["extensions"]["available"]); define("CHANDLER_EXTENSIONS_ENABLED", CHANDLER_ROOT . CHANDLER_ROOT_CONF["extensions"]["enabled"]); -$bootstrap = new Bootstrap(); +Chandler\Extensions\ExtensionManager::getInstance(); -$bootstrap->ignite(); +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();