Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Rest / DisableCommand.php
index 68d95aab8699ea18211cbc083576f0b520f17be6..8044367df66c63b165dd15c62c8497efff53d8b9 100644 (file)
@@ -10,10 +10,8 @@ namespace Drupal\Console\Command\Rest;
 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\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Console\Annotations\DrupalCommand;
-use Drupal\Console\Core\Style\DrupalStyle;
 use Drupal\Console\Command\Shared\RestTrait;
 use Drupal\Core\Config\ConfigFactory;
 use Drupal\rest\Plugin\Type\ResourcePluginManager;
@@ -26,7 +24,6 @@ use Drupal\rest\Plugin\Type\ResourcePluginManager;
  */
 class DisableCommand extends Command
 {
-    use CommandTrait;
     use RestTrait;
 
     /**
@@ -63,13 +60,12 @@ class DisableCommand extends Command
                 'resource-id',
                 InputArgument::OPTIONAL,
                 $this->trans('commands.rest.debug.arguments.resource-id')
-            );
+            )
+            ->setAliases(['red']);
     }
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $resource_id = $input->getArgument('resource-id');
         $rest_resources = $this->getRestResources();
         $rest_resources_ids = array_merge(
@@ -78,7 +74,7 @@ class DisableCommand extends Command
         );
 
         if (!$resource_id) {
-            $resource_id = $io->choice(
+            $resource_id = $this->getIo()->choice(
                 $this->trans('commands.rest.disable.arguments.resource-id'),
                 $rest_resources_ids
             );
@@ -97,7 +93,7 @@ class DisableCommand extends Command
             // Rebuild routing cache.
             $routeBuilder->rebuild();
 
-            $io->success(
+            $this->getIo()->success(
                 sprintf(
                     $this->trans('commands.rest.disable.messages.success'),
                     $resource_id
@@ -106,7 +102,7 @@ class DisableCommand extends Command
             return true;
         }
         $message = sprintf($this->trans('commands.rest.disable.messages.already-disabled'), $resource_id);
-        $io->info($message);
+        $this->getIo()->info($message);
         return true;
     }