TYPO3
7.6
|
Public Member Functions | |
__construct ($triggerDeprecationError=true) | |
select (OutputInterface $output, $question, $choices, $default=null, $attempts=false, $errorMessage= 'Value"%s"is invalid', $multiselect=false) | |
ask (OutputInterface $output, $question, $default=null, array $autocomplete=null) | |
askConfirmation (OutputInterface $output, $question, $default=true) | |
askHiddenResponse (OutputInterface $output, $question, $fallback=true) | |
askAndValidate (OutputInterface $output, $question, $validator, $attempts=false, $default=null, array $autocomplete=null) | |
askHiddenResponseAndValidate (OutputInterface $output, $question, $validator, $attempts=false, $fallback=true) | |
setInputStream ($stream) | |
getInputStream () | |
getName () | |
Public Member Functions inherited from InputAwareHelper | |
setInput (InputInterface $input) | |
Public Member Functions inherited from Helper | |
setHelperSet (HelperSet $helperSet=null) | |
getHelperSet () | |
Private Member Functions | |
getShell () | |
hasSttyAvailable () | |
validateAttempts ($interviewer, OutputInterface $output, $validator, $attempts) | |
Private Attributes | |
$inputStream | |
Static Private Attributes | |
static | $shell |
static | $stty |
Additional Inherited Members | |
Static Public Member Functions inherited from Helper | |
static | strlen ($string) |
static | formatTime ($secs) |
static | formatMemory ($memory) |
static | strlenWithoutDecoration (OutputFormatterInterface $formatter, $string) |
Protected Attributes inherited from InputAwareHelper | |
$input | |
The Dialog class provides helpers to interact with the user.
Definition at line 25 of file DialogHelper.php.
__construct | ( | $triggerDeprecationError = true | ) |
Definition at line 31 of file DialogHelper.php.
ask | ( | OutputInterface | $output, |
$question, | |||
$default = null , |
|||
array | $autocomplete = null |
||
) |
Asks a question to the user.
OutputInterface | $output | An Output instance |
string | array | $question | The question to ask |
string | $default | The default answer if none is given by the user |
array | $autocomplete | List of values to autocomplete |
\RuntimeException | If there is no data to read in the input stream |
Definition at line 109 of file DialogHelper.php.
References DialogHelper\$inputStream, elseif, OutputInterface\getFormatter(), DialogHelper\hasSttyAvailable(), Helper\strlen(), and OutputInterface\write().
Referenced by DialogHelper\askConfirmation(), and DialogHelper\askHiddenResponse().
askAndValidate | ( | OutputInterface | $output, |
$question, | |||
$validator, | |||
$attempts = false , |
|||
$default = null , |
|||
array | $autocomplete = null |
||
) |
Asks for a value and validates the response.
The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
OutputInterface | $output | An Output instance |
string | array | $question | The question to ask |
callable | $validator | A PHP callback |
int | false | $attempts | Max number of times to ask before giving up (false by default, which means infinite) |
string | $default | The default answer if none is given by the user |
array | $autocomplete | List of values to autocomplete |
\Exception | When any of the validators return an error |
Definition at line 347 of file DialogHelper.php.
References DialogHelper\validateAttempts().
Referenced by DialogHelper\select().
askConfirmation | ( | OutputInterface | $output, |
$question, | |||
$default = true |
|||
) |
Asks a confirmation to the user.
The question will be asked until the user answers by nothing, yes, or no.
OutputInterface | $output | An Output instance |
string | array | $question | The question to ask |
bool | $default | The default answer if the user enters nothing |
Definition at line 245 of file DialogHelper.php.
References DialogHelper\ask().
askHiddenResponse | ( | OutputInterface | $output, |
$question, | |||
$fallback = true |
|||
) |
Asks a question to the user, the response is hidden.
OutputInterface | $output | An Output instance |
string | array | $question | The question |
bool | $fallback | In case the response can not be hidden, whether to fallback on non-hidden question or not |
\RuntimeException | In case the fallback is deactivated and the response can not be hidden |
Definition at line 270 of file DialogHelper.php.
References DialogHelper\$shell, DialogHelper\ask(), DialogHelper\getShell(), DialogHelper\hasSttyAvailable(), OutputInterface\write(), and OutputInterface\writeln().
askHiddenResponseAndValidate | ( | OutputInterface | $output, |
$question, | |||
$validator, | |||
$attempts = false , |
|||
$fallback = true |
|||
) |
Asks for a value, hide and validates the response.
The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
OutputInterface | $output | An Output instance |
string | array | $question | The question to ask |
callable | $validator | A PHP callback |
int | false | $attempts | Max number of times to ask before giving up (false by default, which means infinite) |
bool | $fallback | In case the response can not be hidden, whether to fallback on non-hidden question or not |
\Exception | When any of the validators return an error |
\RuntimeException | In case the fallback is deactivated and the response can not be hidden |
Definition at line 376 of file DialogHelper.php.
References DialogHelper\validateAttempts().
getInputStream | ( | ) |
Returns the helper's input stream.
Definition at line 404 of file DialogHelper.php.
References DialogHelper\$inputStream.
getName | ( | ) |
{Returns the canonical name of this helper.
Implements HelperInterface.
Definition at line 412 of file DialogHelper.php.
|
private |
Return a valid Unix shell.
Definition at line 422 of file DialogHelper.php.
Referenced by DialogHelper\askHiddenResponse().
|
private |
Definition at line 444 of file DialogHelper.php.
Referenced by DialogHelper\ask(), and DialogHelper\askHiddenResponse().
select | ( | OutputInterface | $output, |
$question, | |||
$choices, | |||
$default = null , |
|||
$attempts = false , |
|||
$errorMessage = 'Value "%s" is invalid' , |
|||
$multiselect = false |
|||
) |
Asks the user to select a value.
OutputInterface | $output | An Output instance |
string | array | $question | The question to ask |
array | $choices | List of choices to pick from |
bool | string | $default | The default answer if the user enters nothing |
bool | int | $attempts | Max number of times to ask before giving up (false by default, which means infinite) |
string | $errorMessage | Message which will be shown if invalid value from choice list would be picked |
bool | $multiselect | Select more than one value separated by comma |
\InvalidArgumentException |
Definition at line 53 of file DialogHelper.php.
References DialogHelper\askAndValidate(), and OutputInterface\writeln().
setInputStream | ( | $stream | ) |
Sets the input stream to read from when interacting with the user.
This is mainly useful for testing purpose.
resource | $stream | The input stream |
Definition at line 394 of file DialogHelper.php.
|
private |
Validate an attempt.
callable | $interviewer | A callable that will ask for a question and return the result |
OutputInterface | $output | An Output instance |
callable | $validator | A PHP callback |
int | false | $attempts | Max number of times to ask before giving up ; false will ask infinitely |
\Exception | In case the max number of attempts has been reached and no valid response has been given |
Definition at line 467 of file DialogHelper.php.
References Helper\getHelperSet(), and OutputInterface\writeln().
Referenced by DialogHelper\askAndValidate(), and DialogHelper\askHiddenResponseAndValidate().
|
private |
Definition at line 27 of file DialogHelper.php.
Referenced by DialogHelper\ask(), and DialogHelper\getInputStream().
|
staticprivate |
Definition at line 28 of file DialogHelper.php.
Referenced by DialogHelper\askHiddenResponse().
|
staticprivate |
Definition at line 29 of file DialogHelper.php.