handler = new Handler($composer, $io); } /** * {@inheritdoc} */ public function getCapabilities() { return [CommandProvider::class => ScaffoldCommandProvider::class]; } /** * {@inheritdoc} */ public static function getSubscribedEvents() { return [ ScriptEvents::POST_UPDATE_CMD => 'postCmd', ScriptEvents::POST_INSTALL_CMD => 'postCmd', PackageEvents::POST_PACKAGE_INSTALL => 'postPackage', PluginEvents::COMMAND => 'onCommand', ]; } /** * Post command event callback. * * @param \Composer\Script\Event $event * The Composer event. */ public function postCmd(Event $event) { $this->handler->scaffold(); } /** * Post package event behaviour. * * @param \Composer\Installer\PackageEvent $event * Composer package event sent on install/update/remove. */ public function postPackage(PackageEvent $event) { $this->handler->onPostPackageEvent($event); } /** * Pre command event callback. * * @param \Composer\Plugin\CommandEvent $event * The Composer command event. */ public function onCommand(CommandEvent $event) { if ($event->getCommandName() == 'require') { $this->handler->beforeRequire($event); } } }