Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Shared / ConfirmationTrait.php
index aaf1800e667f96ccf72c44a45e0a774fac71fe1a..b1f512d6da67056edf00ee78c7f3fe6087f2f943 100644 (file)
@@ -7,8 +7,6 @@
 
 namespace Drupal\Console\Command\Shared;
 
-use Drupal\Console\Core\Style\DrupalStyle;
-
 /**
  * Class ConfirmationTrait
  *
@@ -17,26 +15,34 @@ use Drupal\Console\Core\Style\DrupalStyle;
 trait ConfirmationTrait
 {
     /**
-     * @param DrupalStyle $io
-     * @param bool        $yes
      *
      * @return bool
      */
-    public function confirmGeneration(DrupalStyle $io, $yes = false)
+    public function confirmOperation()
     {
+        $input = $this->getIo()->getInput();
+        $yes = $input->hasOption('yes') ? $input->getOption('yes') : false;
         if ($yes) {
             return $yes;
         }
 
-        $confirmation = $io->confirm(
+        $confirmation = $this->getIo()->confirm(
             $this->trans('commands.common.questions.confirm'),
             true
         );
 
         if (!$confirmation) {
-            $io->warning($this->trans('commands.common.messages.canceled'));
+            $this->getIo()->warning($this->trans('commands.common.messages.canceled'));
         }
 
         return $confirmation;
     }
+
+    /**
+     * @deprecated
+     */
+    public function confirmGeneration()
+    {
+        return $this->confirmOperation();
+    }
 }