/** * @param Environment $environment * @param array $slimSettings */ public function __construct(Environment $environment, $slimSettings = array()) { // check for existence of APPLICATION_ROOT constant if (!defined('APPLICATION_ROOT')) { throw new Exception("'APPLICATION_ROOT' not defined!"); } //TODO default settings to build environment // set environment default settings $this->environment = $environment; $this->environment->setDefaultSettings($this->getDefaultSettings()); // create slim $this->slim = new \Slim($slimSettings); $this->init(); // hook into route dispatching. // this is necessary so application knows how many routes have been passed/dispatched $this->slim()->hook('slim.before.dispatch', function () { $this->dispatchedRoute(); }); }