SymfonyQuestionHelper
extends QuestionHelper
in package
Symfony Style Guide compliant question helper.
Tags
Table of Contents
Properties
- $helperSet : mixed
- $inputStream : mixed
- $shell : mixed
- $stdinIsInteractive : mixed
- $stty : mixed
Methods
- ask() : mixed
- Asks a question to the user.
- disableStty() : mixed
- Prevents usage of stty.
- formatMemory() : mixed
- formatTime() : mixed
- getHelperSet() : HelperSet
- Gets the helper set associated with this helper.
- getName() : string
- Returns the canonical name of this helper.
- removeDecoration() : mixed
- setHelperSet() : mixed
- Sets the helper set associated with this helper.
- strlen() : int
- Returns the length of a string, using mb_strwidth if it is available.
- strlenWithoutDecoration() : mixed
- substr() : string
- Returns the subset of a string, using mb_substr if it is available.
- formatChoiceQuestionChoices() : array<string|int, string>
- writeError() : mixed
- Outputs an error message.
- writePrompt() : mixed
- Outputs the question prompt.
- autocomplete() : string
- Autocompletes a question.
- doAsk() : mixed
- Asks the question to the user.
- getDefaultAnswer() : mixed
- getHiddenResponse() : string
- Gets a hidden response from user.
- isInteractiveInput() : bool
- mostRecentlyEnteredValue() : string
- resetIOCodepage() : string|false
- Sets console I/O to the specified code page and converts the user input.
- setIOCodepage() : int
- Sets console I/O to the host code page.
- validateAttempts() : mixed
- Validates an attempt.
Properties
$helperSet
protected
mixed
$helperSet
= null
$inputStream
private
mixed
$inputStream
$shell
private
static mixed
$shell
$stdinIsInteractive
private
static mixed
$stdinIsInteractive
$stty
private
static mixed
$stty
= true
Methods
ask()
Asks a question to the user.
public
ask(InputInterface $input, OutputInterface $output, Question $question) : mixed
Parameters
- $input : InputInterface
- $output : OutputInterface
- $question : Question
Tags
Return values
mixed —The user answer
disableStty()
Prevents usage of stty.
public
static disableStty() : mixed
formatMemory()
public
static formatMemory(mixed $memory) : mixed
Parameters
- $memory : mixed
formatTime()
public
static formatTime(mixed $secs) : mixed
Parameters
- $secs : mixed
getHelperSet()
Gets the helper set associated with this helper.
public
getHelperSet() : HelperSet
Return values
HelperSet —A HelperSet instance
getName()
Returns the canonical name of this helper.
public
getName() : string
Return values
string —The canonical name
removeDecoration()
public
static removeDecoration(OutputFormatterInterface $formatter, mixed $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : mixed
setHelperSet()
Sets the helper set associated with this helper.
public
setHelperSet([HelperSet $helperSet = null ]) : mixed
Parameters
- $helperSet : HelperSet = null
strlen()
Returns the length of a string, using mb_strwidth if it is available.
public
static strlen(string $string) : int
Parameters
- $string : string
-
The string to check its length
Return values
int —The length of the string
strlenWithoutDecoration()
public
static strlenWithoutDecoration(OutputFormatterInterface $formatter, mixed $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : mixed
substr()
Returns the subset of a string, using mb_substr if it is available.
public
static substr(string $string, int $from[, int|null $length = null ]) : string
Parameters
- $string : string
-
String to subset
- $from : int
-
Start offset
- $length : int|null = null
-
Length to read
Return values
string —The string subset
formatChoiceQuestionChoices()
protected
formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag) : array<string|int, string>
Parameters
- $question : ChoiceQuestion
- $tag : string
Return values
array<string|int, string>writeError()
Outputs an error message.
protected
writeError(OutputInterface $output, Exception $error) : mixed
Parameters
- $output : OutputInterface
- $error : Exception
writePrompt()
Outputs the question prompt.
protected
writePrompt(OutputInterface $output, Question $question) : mixed
Parameters
- $output : OutputInterface
- $question : Question
autocomplete()
Autocompletes a question.
private
autocomplete(OutputInterface $output, Question $question, resource $inputStream, callable $autocomplete) : string
Parameters
- $output : OutputInterface
- $question : Question
- $inputStream : resource
- $autocomplete : callable
Return values
stringdoAsk()
Asks the question to the user.
private
doAsk(OutputInterface $output, Question $question) : mixed
Parameters
- $output : OutputInterface
- $question : Question
Tags
getDefaultAnswer()
private
getDefaultAnswer(Question $question) : mixed
Parameters
- $question : Question
getHiddenResponse()
Gets a hidden response from user.
private
getHiddenResponse(OutputInterface $output, resource $inputStream[, bool $trimmable = true ]) : string
Parameters
- $output : OutputInterface
- $inputStream : resource
-
The handler resource
- $trimmable : bool = true
-
Is the answer trimmable
Tags
Return values
stringisInteractiveInput()
private
isInteractiveInput(mixed $inputStream) : bool
Parameters
- $inputStream : mixed
Return values
boolmostRecentlyEnteredValue()
private
mostRecentlyEnteredValue(string $entered) : string
Parameters
- $entered : string
Return values
stringresetIOCodepage()
Sets console I/O to the specified code page and converts the user input.
private
resetIOCodepage(int $cp, string|false $input) : string|false
Parameters
- $cp : int
- $input : string|false
Return values
string|falsesetIOCodepage()
Sets console I/O to the host code page.
private
setIOCodepage() : int
Return values
int —Previous code page in IBM/EBCDIC format
validateAttempts()
Validates an attempt.
private
validateAttempts(callable $interviewer, OutputInterface $output, Question $question) : mixed
Parameters
- $interviewer : callable
-
A callable that will ask for a question and return the result
- $output : OutputInterface
- $question : Question
Tags
Return values
mixed —The validated response