Archived
1
0
Fork 0

app/library/Bootstrap.php: use debugger if configured.

This commit is contained in:
Henrik Hautakoski 2018-06-18 20:11:09 +02:00
parent 9dd712045a
commit 2e7c67ba8a

View file

@ -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();
}
}