Symfony Style Guide compliant question helper.
- Full name:
\Symfony\Component\Console\Helper\SymfonyQuestionHelper
- Parent class:
\Symfony\Component\Console\Helper\QuestionHelper
Outputs the question prompt.
protected writePrompt(\Symfony\Component\Console\Output\OutputInterface $output, \Symfony\Component\Console\Question\Question $question): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$question |
\Symfony\Component\Console\Question\Question |
Outputs an error message.
protected writeError(\Symfony\Component\Console\Output\OutputInterface $output, \Exception $error): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$error |
\Exception |
private getEofShortcut(): string
Asks a question to the user.
public ask(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output, \Symfony\Component\Console\Question\Question $question): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | |
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$question |
\Symfony\Component\Console\Question\Question |
Return Value:
The user answer
{@inheritdoc}
public getName(): mixed
Prevents usage of stty.
public static disableStty(): mixed
- This method is static.
Asks the question to the user.
private doAsk(\Symfony\Component\Console\Output\OutputInterface $output, \Symfony\Component\Console\Question\Question $question): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$question |
\Symfony\Component\Console\Question\Question |
private getDefaultAnswer(\Symfony\Component\Console\Question\Question $question): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$question |
\Symfony\Component\Console\Question\Question |
Outputs the question prompt.
protected writePrompt(\Symfony\Component\Console\Output\OutputInterface $output, \Symfony\Component\Console\Question\Question $question): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$question |
\Symfony\Component\Console\Question\Question |
protected formatChoiceQuestionChoices(\Symfony\Component\Console\Question\ChoiceQuestion $question, string $tag): string[]
Parameters:
Parameter | Type | Description |
---|---|---|
$question |
\Symfony\Component\Console\Question\ChoiceQuestion | |
$tag |
string |
Outputs an error message.
protected writeError(\Symfony\Component\Console\Output\OutputInterface $output, \Exception $error): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$error |
\Exception |
Autocompletes a question.
private autocomplete(\Symfony\Component\Console\Output\OutputInterface $output, \Symfony\Component\Console\Question\Question $question, resource $inputStream, callable $autocomplete): string
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$question |
\Symfony\Component\Console\Question\Question | |
$inputStream |
resource | |
$autocomplete |
callable |
private mostRecentlyEnteredValue(string $entered): string
Parameters:
Parameter | Type | Description |
---|---|---|
$entered |
string |
getHiddenResponse
Gets a hidden response from user.
private getHiddenResponse(\Symfony\Component\Console\Output\OutputInterface $output, resource $inputStream, bool $trimmable = true): string
Parameters:
Parameter | Type | Description |
---|---|---|
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$inputStream |
resource | The handler resource |
$trimmable |
bool | Is the answer trimmable |
Validates an attempt.
private validateAttempts(callable $interviewer, \Symfony\Component\Console\Output\OutputInterface $output, \Symfony\Component\Console\Question\Question $question): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$interviewer |
callable | A callable that will ask for a question and return the result |
$output |
\Symfony\Component\Console\Output\OutputInterface | |
$question |
\Symfony\Component\Console\Question\Question |
Return Value:
The validated response
private isInteractiveInput(mixed $inputStream): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$inputStream |
mixed |
Reads one or more lines of input and returns what is read.
private readInput(resource $inputStream, \Symfony\Component\Console\Question\Question $question): string|false
Parameters:
Parameter | Type | Description |
---|---|---|
$inputStream |
resource | The handler resource |
$question |
\Symfony\Component\Console\Question\Question | The question being asked |
Return Value:
The input received, false in case input could not be read
Sets console I/O to the host code page.
private setIOCodepage(): int
Return Value:
Previous code page in IBM/EBCDIC format
Sets console I/O to the specified code page and converts the user input.
private resetIOCodepage(int $cp, string|false $input): string|false
Parameters:
Parameter | Type | Description |
---|---|---|
$cp |
int | |
$input |
string|false |
Clones an input stream in order to act on one instance of the same stream without affecting the other instance.
private cloneInputStream(resource $inputStream): resource|null
Parameters:
Parameter | Type | Description |
---|---|---|
$inputStream |
resource | The handler resource |
Return Value:
The cloned resource, null in case it could not be cloned
Sets the helper set associated with this helper.
public setHelperSet(\Symfony\Component\Console\Helper\HelperSet $helperSet = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$helperSet |
\Symfony\Component\Console\Helper\HelperSet |
Gets the helper set associated with this helper.
public getHelperSet(): \Symfony\Component\Console\Helper\HelperSet|null
Returns the length of a string, using mb_strwidth if it is available.
public static strlen(?string $string): int
-
This method is static.
-
Warning: this method is deprecated. This means that this method will likely be removed in a future version.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
?string |
Returns the width of a string, using mb_strwidth if it is available.
public static width(?string $string): int
The width is how many characters positions the string will use.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
?string |
Returns the length of a string, using mb_strlen if it is available.
public static length(?string $string): int
The length is related to how many bytes the string will use.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
?string |
Returns the subset of a string, using mb_substr if it is available.
public static substr(?string $string, int $from, int $length = null): string
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
?string | |
$from |
int | |
$length |
int |
public static formatTime(mixed $secs): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$secs |
mixed |
public static formatMemory(int $memory): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$memory |
int |
public static strlenWithoutDecoration(\Symfony\Component\Console\Formatter\OutputFormatterInterface $formatter, ?string $string): mixed
-
This method is static.
-
Warning: this method is deprecated. This means that this method will likely be removed in a future version.
Parameters:
Parameter | Type | Description |
---|---|---|
$formatter |
\Symfony\Component\Console\Formatter\OutputFormatterInterface | |
$string |
?string |
public static removeDecoration(\Symfony\Component\Console\Formatter\OutputFormatterInterface $formatter, ?string $string): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$formatter |
\Symfony\Component\Console\Formatter\OutputFormatterInterface | |
$string |
?string |