8e8edfe9c698e9c69bf57c2a4e161ae676f74e96
[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  *
16  * @package Drupal\Console\Core\Helper
17  */
18 class DrupalChoiceQuestionHelper extends SymfonyQuestionHelper
19 {
20     /**
21      * {@inheritdoc}
22      */
23     protected function writePrompt(OutputInterface $output, Question $question)
24     {
25         $text = $question->getQuestion();
26         $default = $question->getDefault();
27         $choices = $question->getChoices();
28
29         $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $choices[$default]);
30
31         $output->writeln($text);
32
33         $output->write(' > ');
34     }
35 }