dispatcher = $dispatcher; $this->extension_manager = $extension_manager; } public function load() { $finder = $this->extension_manager->get_finder(); $subscriber_classes = $finder ->extension_directory('/event') ->suffix('listener') ->core_path('event/') ->get_classes(); foreach ($subscriber_classes as $class) { $subscriber = new $class(); $this->dispatcher->addSubscriber($subscriber); } } }