dispatcher = new EventDispatcher(); } /** * {@inheritdoc} */ public function addRoute(RouteWrapperInterface $route) { $this->set($route->getIdentifier(), $route); $this->dispatcher->addListener('router.built', [ $route, 'onRouterBuilt' ]); } /** * {@inheritdoc} */ public function finalize() { $this->dispatcher->dispatch('router.built', new RouterBuiltEvent($this)); } }