api/laravel/Console/QuestionHelper.yaml
2024-09-26 02:03:21 -07:00

59 lines
3 KiB
YAML

name: QuestionHelper
class_comment: null
dependencies:
- name: TwoColumnDetail
type: class
source: Illuminate\Console\View\Components\TwoColumnDetail
- name: OutputFormatter
type: class
source: Symfony\Component\Console\Formatter\OutputFormatter
- name: SymfonyQuestionHelper
type: class
source: Symfony\Component\Console\Helper\SymfonyQuestionHelper
- name: OutputInterface
type: class
source: Symfony\Component\Console\Output\OutputInterface
- name: ChoiceQuestion
type: class
source: Symfony\Component\Console\Question\ChoiceQuestion
- name: ConfirmationQuestion
type: class
source: Symfony\Component\Console\Question\ConfirmationQuestion
- name: Question
type: class
source: Symfony\Component\Console\Question\Question
properties: []
methods:
- name: ensureEndsWithPunctuation
visibility: protected
parameters:
- name: string
comment: "# * {@inheritdoc}\n# *\n# * @return void\n# */\n# #[\\Override]\n# protected\
\ function writePrompt(OutputInterface $output, Question $question): void\n# {\n\
# $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());\n\
# \n# $text = $this->ensureEndsWithPunctuation($text);\n# \n# $text = \" <fg=default;options=bold>$text</></>\"\
;\n# \n# $default = $question->getDefault();\n# \n# if ($question->isMultiline())\
\ {\n# $text .= sprintf(' (press %s to continue)', 'Windows' == PHP_OS_FAMILY\n\
# ? '<comment>Ctrl+Z</comment> then <comment>Enter</comment>'\n# : '<comment>Ctrl+D</comment>');\n\
# }\n# \n# switch (true) {\n# case null === $default:\n# $text = sprintf('<info>%s</info>',\
\ $text);\n# \n# break;\n# \n# case $question instanceof ConfirmationQuestion:\n\
# $text = sprintf('<info>%s (yes/no)</info> [<comment>%s</comment>]', $text, $default\
\ ? 'yes' : 'no');\n# \n# break;\n# \n# case $question instanceof ChoiceQuestion:\n\
# $choices = $question->getChoices();\n# $text = sprintf('<info>%s</info> [<comment>%s</comment>]',\
\ $text, OutputFormatter::escape($choices[$default] ?? $default));\n# \n# break;\n\
# \n# default:\n# $text = sprintf('<info>%s</info> [<comment>%s</comment>]', $text,\
\ OutputFormatter::escape($default));\n# \n# break;\n# }\n# \n# $output->writeln($text);\n\
# \n# if ($question instanceof ChoiceQuestion) {\n# foreach ($question->getChoices()\
\ as $key => $value) {\n# with(new TwoColumnDetail($output))->render($value, $key);\n\
# }\n# }\n# \n# $output->write('<options=bold>\u276F </>');\n# }\n# \n# /**\n\
# * Ensures the given string ends with punctuation.\n# *\n# * @param string \
\ $string\n# * @return string"
traits:
- Illuminate\Console\View\Components\TwoColumnDetail
- Symfony\Component\Console\Formatter\OutputFormatter
- Symfony\Component\Console\Helper\SymfonyQuestionHelper
- Symfony\Component\Console\Output\OutputInterface
- Symfony\Component\Console\Question\ChoiceQuestion
- Symfony\Component\Console\Question\ConfirmationQuestion
- Symfony\Component\Console\Question\Question
interfaces: []