Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Module / InstallDependencyCommand.php
index 56ca8694a379513fa71ac790d60ccc6675972dc9..306602b3ecc2df080e24a99c65e733544b5183da 100644 (file)
@@ -7,18 +7,16 @@
 
 namespace Drupal\Console\Command\Module;
 
-use Drupal\Console\Core\Command\Shared\CommandTrait;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Command\Shared\ProjectDownloadTrait;
 use Drupal\Console\Command\Shared\ModuleTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
 use Drupal\Console\Utils\Site;
 use Drupal\Console\Utils\Validator;
-use Drupal\Core\ProxyClass\Extension\ModuleInstaller;
+use Drupal\Core\Extension\ModuleInstallerInterface;
 use Drupal\Console\Core\Utils\ChainQueue;
 
 /**
@@ -28,7 +26,6 @@ use Drupal\Console\Core\Utils\ChainQueue;
  */
 class InstallDependencyCommand extends Command
 {
-    use CommandTrait;
     use ProjectDownloadTrait;
     use ModuleTrait;
 
@@ -38,13 +35,13 @@ class InstallDependencyCommand extends Command
     protected $site;
 
     /**
- * @var Validator
-*/
    * @var Validator
+     */
     protected $validator;
 
     /**
- * @var ModuleInstaller
-*/
+     * @var ModuleInstallerInterface
+     */
     protected $moduleInstaller;
 
     /**
@@ -55,14 +52,15 @@ class InstallDependencyCommand extends Command
     /**
      * InstallCommand constructor.
      *
-     * @param Site       $site
-     * @param Validator  $validator
-     * @param ChainQueue $chainQueue
+     * @param Site                     $site
+     * @param Validator                $validator
+     * @param ModuleInstallerInterface $moduleInstaller
+     * @param ChainQueue               $chainQueue
      */
     public function __construct(
         Site $site,
         Validator $validator,
-        ModuleInstaller $moduleInstaller,
+        ModuleInstallerInterface $moduleInstaller,
         ChainQueue $chainQueue
     ) {
         $this->site = $site;
@@ -79,12 +77,12 @@ class InstallDependencyCommand extends Command
     {
         $this
             ->setName('module:dependency:install')
-            ->setDescription($this->trans('commands.module.install.dependencies.description'))
+            ->setDescription($this->trans('commands.module.dependency.install.description'))
             ->addArgument(
                 'module',
                 InputArgument::IS_ARRAY,
-                $this->trans('commands.module.install.dependencies.arguments.module')
-            );
+                $this->trans('commands.module.dependency.install.arguments.module')
+            )->setAliases(['modi']);
     }
 
     /**
@@ -92,12 +90,10 @@ class InstallDependencyCommand extends Command
      */
     protected function interact(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $module = $input->getArgument('module');
         if (!$module) {
             // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
-            $module = $this->moduleQuestion($io);
+            $module = $this->moduleQuestion();
             $input->setArgument('module', $module);
         }
     }
@@ -107,20 +103,18 @@ class InstallDependencyCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $module = $input->getArgument('module');
         $unInstalledDependencies = $this->calculateDependencies((array)$module);
 
         if (!$unInstalledDependencies) {
-            $io->warning($this->trans('commands.module.install.dependencies.messages.no-depencies'));
+            $this->getIo()->warning($this->trans('commands.module.dependency.install.messages.no-depencies'));
             return 0;
         }
 
         try {
-            $io->comment(
+            $this->getIo()->comment(
                 sprintf(
-                    $this->trans('commands.module.install.dependencies.messages.installing'),
+                    $this->trans('commands.module.dependency.install.messages.installing'),
                     implode(', ', $unInstalledDependencies)
                 )
             );
@@ -128,14 +122,14 @@ class InstallDependencyCommand extends Command
             drupal_static_reset('system_rebuild_module_data');
 
             $this->moduleInstaller->install($unInstalledDependencies, true);
-            $io->success(
+            $this->getIo()->success(
                 sprintf(
-                    $this->trans('commands.module.install.dependencies.messages.success'),
+                    $this->trans('commands.module.dependency.install.messages.success'),
                     implode(', ', $unInstalledDependencies)
                 )
             );
         } catch (\Exception $e) {
-            $io->error($e->getMessage());
+            $this->getIo()->error($e->getMessage());
 
             return 1;
         }