From 2e7c67ba8a190f68d17790b1db7cffccdd2ab1b0 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 18 Jun 2018 20:11:09 +0200 Subject: [PATCH] app/library/Bootstrap.php: use debugger if configured. --- app/library/Bootstrap.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/library/Bootstrap.php b/app/library/Bootstrap.php index 10b9810..932ec34 100644 --- a/app/library/Bootstrap.php +++ b/app/library/Bootstrap.php @@ -17,10 +17,11 @@ class Bootstrap extends Injectable $this->setDI($di); } - public function run() + /** + * Prepares the application to run. + */ + public function prepare() { - $app = new Application($this->getDI()); - // Force autoloader if registered. // Should be needed by almost all other services. $di = $this->getDI(); @@ -28,6 +29,22 @@ class Bootstrap extends Injectable $di->get('loader'); } + // If debug is configured. add listener. + if ($di->get('config')->application->debug) { + $di->get('debugger')->listen(true, true); + } + + return $this; + } + + /** + * Runs the application. + * + * @return string + */ + public function run() + { + $app = new Application($this->getDI()); return $app->handle()->getContent(); } }