/** * Initialise the boostrap process * * This simple call will start the filter chain in motion * * @param string|null $environment */ public function init($environment = null) { $this->serviceManager->set('events', $this->events); $this->events->get()->trigger((new Bootstrap('proem.init'))->setServiceManager($this->serviceManager)->setEnvironment($environment), function ($response) { if ($response instanceof Proem\Filter\Manager\Template) { $this->filterManager = $response; } }); if ($this->filterManager === null) { $this->filterManager = new FilterManager(); } $this->filterManager->setServiceManager($this->serviceManager)->attachEvent(new Response(), FilterManager::RESPONSE_EVENT_PRIORITY)->attachEvent(new Request(), FilterManager::REQUEST_EVENT_PRIORITY)->attachEvent(new Route(), FilterManager::ROUTE_EVENT_PRIORITY)->attachEvent(new Dispatch(), FilterManager::DISPATCH_EVENT_PRIORITY)->init(); }