From c9291ab137839f026aeb210c324d885b53e8f986 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Mon, 26 Jun 2023 22:23:42 +0530 Subject: [PATCH] ACMS-1866: Code cleanup & fixed PHPCS issue. --- src/Config/ConfigInitializer.php | 2 +- src/Plugin.php | 43 +++----------------------------- 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/src/Config/ConfigInitializer.php b/src/Config/ConfigInitializer.php index 84fbaf8..1a9bc72 100644 --- a/src/Config/ConfigInitializer.php +++ b/src/Config/ConfigInitializer.php @@ -28,7 +28,7 @@ class ConfigInitializer { /** * Processor. * - * @var Acquia\Drupal\RecommendedSettings\Config\YamlConfigProcessor + * @var \Acquia\Drupal\RecommendedSettings\Config\YamlConfigProcessor */ protected $processor; diff --git a/src/Plugin.php b/src/Plugin.php index 1d9da7a..2617e64 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -35,20 +35,6 @@ class Plugin implements PluginInterface, EventSubscriberInterface { */ protected $io; - /** - * The Composer Scaffold handler. - * - * @var \Drupal\Composer\Plugin\Scaffold\Handler - */ - protected $handler; - - /** - * Record whether the 'require' command was called. - * - * @var bool - */ - protected $drsIncluded; - /** * Stores this plugin package object. * @@ -62,7 +48,6 @@ class Plugin implements PluginInterface, EventSubscriberInterface { public function activate(Composer $composer, IOInterface $io) { $this->composer = $composer; $this->io = $io; - $this->drsIncluded = FALSE; } /** @@ -90,7 +75,7 @@ public static function getSubscribedEvents() { } /** - * Marks Acquia Drupal Recommended Settings to be processed after an install or update command. + * Marks this plugin to be processed after package install or update event. * * @param \Composer\Installer\PackageEvent $event * Event. @@ -105,12 +90,13 @@ public function onPostPackageEvent(PackageEvent $event) { } /** - * Execute Acquia Drupal Recommended Settings drs:update after update command has been executed. + * Includes Acquia recommended settings post composer update/install command. * * @throws \Exception */ public function onPostCmdEvent() { - // Only install the template files if acquia/drupal-recommended-settings was installed. + // Only install the template files, if the drupal-recommended-settings + // plugin is installed. if ($this->settingsPackage) { $settings = new Settings($this->composer, $this->io, $this->settingsPackage); $settings->hashSalt(); @@ -140,25 +126,4 @@ protected function getSettingsPackage(OperationInterface $operation) { return NULL; } - /** - * Hook for pre-package install. - */ - public function prePackageInstall(PackageEvent $event) { - if (!$this->drsIncluded) { - $operations = $event->getOperations(); - foreach ($operations as $operation) { - if ($operation instanceof InstallOperation) { - $package = $operation->getPackage(); - } - elseif ($operation instanceof UpdateOperation) { - $package = $operation->getTargetPackage(); - } - if (isset($package) && $package instanceof PackageInterface && $package->getName() == 'acquia/drupal-recommended-settings') { - $this->drsIncluded = TRUE; - break; - } - } - } - } - }