Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console-core / src / Command / Settings / SetCommand.php
index 0fc9ba68ec6908b17b84cfb2e2166a0facce1ef3..ce10b798640b1f20002b53cf8d0d84a8260f1fc2 100644 (file)
@@ -12,11 +12,9 @@ use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Yaml\Dumper;
 use Symfony\Component\Yaml\Parser;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Core\Utils\ConfigurationManager;
 use Drupal\Console\Core\Utils\NestedArray;
-use Drupal\Console\Core\Style\DrupalStyle;
 
 /**
  * Class SetCommand
@@ -25,8 +23,6 @@ use Drupal\Console\Core\Style\DrupalStyle;
  */
 class SetCommand extends Command
 {
-    use CommandTrait;
-
     /**
      * @var ConfigurationManager
      */
@@ -80,7 +76,6 @@ class SetCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
         $parser = new Parser();
         $dumper = new Dumper();
 
@@ -93,7 +88,7 @@ class SetCommand extends Command
         );
 
         if (!file_exists($userConfigFile)) {
-            $io->error(
+            $this->getIo()->error(
                 sprintf(
                     $this->trans('commands.settings.set.messages.missing-file'),
                     $userConfigFile
@@ -107,7 +102,7 @@ class SetCommand extends Command
                 file_get_contents($userConfigFile)
             );
         } catch (\Exception $e) {
-            $io->error(
+            $this->getIo()->error(
                 $this->trans(
                     'commands.settings.set.messages.error-parsing'
                 ) . ': ' . $e->getMessage()
@@ -127,7 +122,7 @@ class SetCommand extends Command
         try {
             $userConfigFileDump = $dumper->dump($userConfigFileParsed, 10);
         } catch (\Exception $e) {
-            $io->error(
+            $this->getIo()->error(
                 [
                     $this->trans('commands.settings.set.messages.error-generating'),
                     $e->getMessage()
@@ -144,7 +139,7 @@ class SetCommand extends Command
 
             $translatorLanguage = $this->getApplication()->getTranslator()->getLanguage();
             if ($translatorLanguage != $settingValue) {
-                $io->error(
+                $this->getIo()->error(
                     sprintf(
                         $this->trans('commands.settings.set.messages.missing-language'),
                         $settingValue
@@ -158,7 +153,7 @@ class SetCommand extends Command
         try {
             file_put_contents($userConfigFile, $userConfigFileDump);
         } catch (\Exception $e) {
-            $io->error(
+            $this->getIo()->error(
                 [
                     $this->trans('commands.settings.set.messages.error-writing'),
                     $e->getMessage()
@@ -168,7 +163,7 @@ class SetCommand extends Command
             return 1;
         }
 
-        $io->success(
+        $this->getIo()->success(
             sprintf(
                 $this->trans('commands.settings.set.messages.success'),
                 $settingName,