initAutoloader($moduleManager->getOptions()->getApplicationEnv()); } protected function initAutoloader($env = null) { require __DIR__ . '/autoload_register.php'; } public static function getConfig() { return new Config(include __DIR__ . '/configs/module.config.php'); } public function registerApplicationListeners(EventCollection $events, Locator $locator, Config $config) { $view = $locator->get('view'); $viewListener = $this->getViewListener($view, $config); $events->attachAggregate($viewListener); } public function registerStaticListeners(StaticEventCollection $events, Locator $locator, Config $config) { $view = $locator->get('view'); $viewListener = $this->getViewListener($view, $config); $viewListener->registerStaticListeners($events, $locator); } protected function getViewListener($view, $config) { if ($this->viewListener instanceof View\Listener) { return $this->viewListener; } $viewListener = new View\Listener($view, $config->layout); $viewListener->setDisplayExceptionsFlag($config->display_exceptions); $this->viewListener = $viewListener; return $viewListener; } }