Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console-core / src / Command / Chain / ChainCustomCommand.php
index 3abd2215b94b5bbe18f9607ea9690801cba208c2..0306ff7a202d724443dfb659c32a94c7fa7be879 100644 (file)
@@ -9,20 +9,17 @@ namespace Drupal\Console\Core\Command\Chain;
 
 use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Input\InputOption;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Symfony\Component\Console\Output\OutputInterface;
 use Drupal\Console\Core\Command\Shared\InputTrait;
 
 /**
  * Class ChainCustomCommand
  *
- * @package Drupal\Console\Core\Command\ChainRegister
+ * @package Drupal\Console\Core\Command\ChainCustomCommand
  */
-class ChainCustomCommand extends Command
+class ChainCustomCommand extends BaseCommand
 {
-    use CommandTrait;
     use InputTrait;
 
     /**
@@ -41,19 +38,33 @@ class ChainCustomCommand extends Command
     protected $file;
 
     /**
-     * ChainRegister constructor.
+     * ChainCustomCommand constructor.
      *
      * @param $name
      * @param $description
      * @param $file
+     * @param $chainDiscovery
      */
-    public function __construct($name, $description, $file)
-    {
+    public function __construct(
+        $name,
+        $description,
+        $file,
+        $chainDiscovery
+    ) {
         $this->name = $name;
         $this->description = $description;
         $this->file = $file;
 
-        parent::__construct();
+        parent::__construct($chainDiscovery);
+        $this->ignoreValidationErrors();
+
+        $this->addOption(
+            'file',
+            null,
+            InputOption::VALUE_OPTIONAL,
+            null,
+            $file
+        );
     }
 
     /**
@@ -63,13 +74,7 @@ class ChainCustomCommand extends Command
     {
         $this
             ->setName($this->name)
-            ->setDescription($this->description)
-            ->addOption(
-                'placeholder',
-                null,
-                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
-                $this->trans('commands.chain.options.placeholder')
-            );
+            ->setDescription($this->description);
     }
 
     /**
@@ -84,23 +89,14 @@ class ChainCustomCommand extends Command
             '--file'  => $this->file,
         ];
 
-        if ($placeholder = $input->getOption('placeholder')) {
-            $arguments['--placeholder'] = $this->inlineValueAsArray($placeholder);
-        }
-
         foreach ($input->getOptions() as $option => $value) {
-            if ($option != 'placeholder' && $value) {
-                if (is_bool($value)) {
-                    $value = true;
-                }
-                $arguments['--'.$option] = $value;
+            if ($value) {
+                $arguments['--' . $option] = $value;
             }
         }
 
         $commandInput = new ArrayInput($arguments);
-        if (array_key_exists('--no-interaction', $arguments)) {
-            $commandInput->setInteractive(false);
-        }
+        $commandInput->setInteractive(true);
 
         return $command->run($commandInput, $output);
     }