Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / State / OverrideCommand.php
index b7a8932bb25c0622769d31e3c196d4d90a47ff5a..50385ceba13b0642f304195a96b53ab15fe5876f 100644 (file)
@@ -10,11 +10,9 @@ namespace Drupal\Console\Command\State;
 use Symfony\Component\Console\Input\InputArgument;
 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\Core\KeyValueStore\KeyValueFactoryInterface;
 use Drupal\Core\State\StateInterface;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
 use Drupal\Component\Serialization\Yaml;
 
 /**
@@ -24,8 +22,6 @@ use Drupal\Component\Serialization\Yaml;
  */
 class OverrideCommand extends Command
 {
-    use CommandTrait;
-
     /**
      * @var StateInterface
      */
@@ -69,27 +65,26 @@ class OverrideCommand extends Command
                 'value',
                 InputArgument::OPTIONAL,
                 $this->trans('commands.state.override.arguments.value')
-            );
+            )->setAliases(['sto']);
     }
     /**
      * {@inheritdoc}
      */
     protected function interact(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
         $key = $input->getArgument('key');
         $value = $input->getArgument('value');
 
         if (!$key) {
             $names = array_keys($this->keyValue->get('state')->getAll());
-            $key = $io->choiceNoList(
+            $key = $this->getIo()->choiceNoList(
                 $this->trans('commands.state.override.arguments.key'),
                 $names
             );
             $input->setArgument('key', $key);
         }
         if (!$value) {
-            $value = $io->ask(
+            $value = $this->getIo()->ask(
                 $this->trans('commands.state.override.arguments.value')
             );
             $input->setArgument('value', $value);
@@ -100,18 +95,17 @@ class OverrideCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
         $key = $input->getArgument('key');
         $value = $input->getArgument('value');
 
         if (!$key) {
-            $io->error($this->trans('commands.state.override.errors.no-key'));
+            $this->getIo()->error($this->trans('commands.state.override.errors.no-key'));
 
             return 1;
         }
 
         if (!$value) {
-            $io->error($this->trans('commands.state.override.errors.no-value'));
+            $this->getIo()->error($this->trans('commands.state.override.errors.no-value'));
 
             return 1;
         }
@@ -128,7 +122,7 @@ class OverrideCommand extends Command
 
             $tableRows[] = [$key, $originalValue, $overrideValue];
 
-            $io->table(
+            $this->getIo()->table(
                 $tableHeaders,
                 $tableRows
             );