*/
class SymfonyQuestionHelper extends QuestionHelper
{
/**
* {@inheritdoc}
*/
protected function writePrompt(OutputInterface $output, Question $question)
{
$text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
$default = $question->getDefault();
if ($question->isMultiline()) {
$text .= sprintf(' (press %s to continue)', $this->getEofShortcut());
}
switch (true) {
case null === $default:
$text = sprintf(' %s:', $text);
break;
case $question instanceof ConfirmationQuestion:
$text = sprintf(' %s (yes/no) [%s]:', $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(' %s [%s]:', $text, OutputFormatter::escape(implode(', ', $default)));
break;
case $question instanceof ChoiceQuestion:
$choices = $question->getChoices();
$text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
break;
default:
$text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($default));
}
$output->writeln($text);
$prompt = ' > ';
if ($question instanceof ChoiceQuestion) {
$output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
$prompt = $question->getPrompt();
}
$output->write($prompt);
}
/**
* {@inheritdoc}
*/
protected function writeError(OutputInterface $output, \Exception $error)
{
if ($output instanceof SymfonyStyle) {
$output->newLine();
$output->error($error->getMessage());
return;
}
parent::writeError($output, $error);
}
private function getEofShortcut(): string
{
if ('Windows' === \PHP_OS_FAMILY) {
return 'Ctrl+Z then Enter';
}
return 'Ctrl+D';
}
}
__halt_compiler();----SIGNATURE:----nktNU6lwyG02o90MYx/yXSwJpbMLLwCA69yn/eP9f2kQAsKcZpDMJAyFkpEd8mEyyDYwylvtCcCxcxx63/F6YSZcPH15UpehE5A2O9g5a93DBwmyrOw0keH2sYlXMUuvE++kf8jQVTJLIheaZQszSdWUDsj4ABfoC5JvKB7S6ID0W/YzU29JF+BlMRE+Y6h6Bz9xnB+YTnuLs1HNF+mNHpbRtprwvB1ovM4sAHcm4LHhG8ThRpRklLr5QdWbW9AaGX/YyO5EEBkJPEnd6sD3kQAWJcgADe9Qv7/gsT6KAtZtzku7uLvaY+OYUwfFblAmNXkm76JdOn7tVAdBL/2kzPvBrleIbYNTP/xu9x5gZ3XWQmcE6WEQeXleyVpofn4WVpwWmrUvwTBny/piCglSb1rxzPpsDS+r8f7OnbdZ6jNZnVLyFrdZsT7gyAlUxj1+w+zryyAJTQrbH4hQbttldfOzFWysKHPgeDKI+YjMW/gIYtxsC0HWHS5FHGH834qvthXqxhHuHRKSbEWsRz0gxEsGt2ngkPnL0y4kasaKmLX3+6OwFLJWh+xawShlpmHJOw7BXOtRvWQU/UTNR8y4kvrTM1UViV9S+qA3cYClKhBlbo9AUWP6cjdtuuSW5zay/7cFckB4Lt2lfgkXk7zwOzPU9kKGvJSKNaGRnF1E4qI=----ATTACHMENT:----MjYwNzUxNjg2NTAxODgxNiAxNDg0OTA1NTE5OTMyOTU4IDcwNDQ5NzU4MDM1NjI5NDM=