/** * Adds a plugin, activates it and registers it with the event dispatcher * * @param PluginInterface $plugin plugin instance */ public function addPlugin(PluginInterface $plugin) { $this->plugins[] = $plugin; $plugin->activate($this->composer, $this->io); if ($plugin instanceof EventSubscriberInterface) { $this->composer->getEventDispatcher()->addSubscriber($plugin); } }