setupRouter(); $this->setupRoutes(); } /** * Set up the router. * * @return void */ private function setupRouter(): void { $this->router = new BramusRouter(); $this->router->setNamespace('\Application\Controller'); } /** * Route-configuration will be done here. * * @return void */ private function setupRoutes(): void { $this->router->match('GET', '/', function () { (new HomeController())(); }); $this->router->match('GET', '/messages', function () { echo "
Lorem Ipsum Dolor
"; }); $this->router->match('GET', '/style.css', function () { (new ScssCompiler())->compile(); }); $this->router->match('GET', '/debugbar/styles.css', function () { #DebugBar::getInstance()->dumpCssAssets(); }); $this->router->match('GET', '/debugbar/javascript.js', function () { #DebugBar::getInstance()->dumpJsAssets(); }); $this->router->match('GET', '/article/(\w+)-(\w+)', function ($name, $id) { (new ArticleController())(['name' => $name, 'id' => $id]); }); } /** * Run the routing and thus call the controllers. * * @return void */ public function serve(): void { $this->router->run(); } }