switch (true
) { case null ===
$default:
$text =
sprintf(' <info>%s</info>:',
$text);
break;
case $question instanceof ConfirmationQuestion:
$text =
sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:',
$text,
$default ? 'yes' : 'no'
);
break;
case $question instanceof ChoiceQuestion &&
$question->
isMultiselect():
$choices =
$question->
getChoices();
$default =
explode(',',
$default);
foreach ($default as $key =>
$value) { $default[$key] =
$choices[trim($value)];
} $text =
sprintf(' <info>%s</info> [<comment>%s</comment>]:',
$text, OutputFormatter::
escape(implode(', ',
$default)));
break;