diff --git a/src/Application.php b/src/Application.php index 0bab6032..d33251b8 100644 --- a/src/Application.php +++ b/src/Application.php @@ -1,6 +1,7 @@ router = new RouteCollection; $this->templating = new TemplateEngine; + $this->configuration = new ConfigManager($config); echo 'hello!'; } @@ -52,6 +56,20 @@ class Application } } + public function hasRouter(): bool + { + return !is_null($this->router) && $this->router instanceof RouteCollection; + } + + public function getRouter(): RouteCollection + { + if (!$this->hasRouter()) { + throw new \Exception('No RouteCollection instance is available.'); + } + + return $this->router; + } + public function hasTemplating(): bool { return !is_null($this->templating) && $this->templating instanceof TemplateEngine;