From 2ccddd390d0b02c19d14cbae99dfe43706e4872d Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 2 Jan 2018 21:57:06 +0100 Subject: [PATCH] Create instance of ConfigManager and RouteCollection in Application. --- src/Application.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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;