788a81d9333cb7f57045d6f104031921aee94a5b
[yaffs-website] / vendor / drupal / console-core / src / Helper / DrupalChoiceQuestionHelper.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\Console\Core\Helper\DrupalChoiceQuestionHelper.
5  */
6
7 namespace Drupal\Console\Core\Helper;
8
9 use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
10 use Symfony\Component\Console\Output\OutputInterface;
11 use Symfony\Component\Console\Question\Question;
12
13 /**
14  * Class DrupalChoiceQuestionHelper
15  * @package Drupal\Console\Core\Helper
16  */
17 class DrupalChoiceQuestionHelper extends SymfonyQuestionHelper
18 {
19     /**
20      * {@inheritdoc}
21      */
22     protected function writePrompt(OutputInterface $output, Question $question)
23     {
24         $text = $question->getQuestion();
25         $default = $question->getDefault();
26         $choices = $question->getChoices();
27
28         $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $choices[$default]);
29
30         $output->writeln($text);
31
32         $output->write(' > ');
33     }
34 }