Class Symfony\Component\Console\Question\ChoiceQuestion

InheritanceSymfony\Component\Console\Question\ChoiceQuestion » Symfony\Component\Console\Question\Question

Represents a choice question.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Console\Question\ChoiceQuestion
getAutocompleterValues() Gets values for the autocompleter. Symfony\Component\Console\Question\Question
getChoices() Returns available choices. Symfony\Component\Console\Question\ChoiceQuestion
getDefault() Returns the default answer. Symfony\Component\Console\Question\Question
getMaxAttempts() Gets the maximum number of attempts. Symfony\Component\Console\Question\Question
getNormalizer() Gets the normalizer for the response. Symfony\Component\Console\Question\Question
getPrompt() Gets the prompt for choices. Symfony\Component\Console\Question\ChoiceQuestion
getQuestion() Returns the question. Symfony\Component\Console\Question\Question
getValidator() Gets the validator for the question. Symfony\Component\Console\Question\Question
isHidden() Returns whether the user response must be hidden. Symfony\Component\Console\Question\Question
isHiddenFallback() In case the response can not be hidden, whether to fallback on non-hidden question or not. Symfony\Component\Console\Question\Question
isMultiselect() Returns whether the choices are multiselect. Symfony\Component\Console\Question\ChoiceQuestion
setAutocompleterValues() Sets values for the autocompleter. Symfony\Component\Console\Question\Question
setErrorMessage() Sets the error message for invalid values. Symfony\Component\Console\Question\ChoiceQuestion
setHidden() Sets whether the user response must be hidden or not. Symfony\Component\Console\Question\Question
setHiddenFallback() Sets whether to fallback on non-hidden question if the response can not be hidden. Symfony\Component\Console\Question\Question
setMaxAttempts() Sets the maximum number of attempts. Symfony\Component\Console\Question\Question
setMultiselect() Sets multiselect option. Symfony\Component\Console\Question\ChoiceQuestion
setNormalizer() Sets a normalizer for the response. Symfony\Component\Console\Question\Question
setPrompt() Sets the prompt for choices. Symfony\Component\Console\Question\ChoiceQuestion
setValidator() Sets a validator for the question. Symfony\Component\Console\Question\Question

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
isAssoc() Symfony\Component\Console\Question\Question

Method Details

__construct() public method

Constructor.

public void __construct ( $question, array $choices, $default null )
$question string

The question to ask to the user

$choices array

The list of available choices

$default mixed

The default answer to return

getChoices() public method

Returns available choices.

public array getChoices ( )
getPrompt() public method

Gets the prompt for choices.

public string getPrompt ( )
isMultiselect() public method

Returns whether the choices are multiselect.

public bool isMultiselect ( )
setErrorMessage() public method

Sets the error message for invalid values.

The error message has a string placeholder (%s) for the invalid value.

public Symfony\Component\Console\Question\ChoiceQuestion setErrorMessage ( $errorMessage )
$errorMessage string
return Symfony\Component\Console\Question\ChoiceQuestion

The current instance

setMultiselect() public method

Sets multiselect option.

When multiselect is set to true, multiple choices can be answered.

public Symfony\Component\Console\Question\ChoiceQuestion setMultiselect ( $multiselect )
$multiselect bool
return Symfony\Component\Console\Question\ChoiceQuestion

The current instance

setPrompt() public method

Sets the prompt for choices.

public Symfony\Component\Console\Question\ChoiceQuestion setPrompt ( $prompt )
$prompt string
return Symfony\Component\Console\Question\ChoiceQuestion

The current instance