\Composer\QuestionStrictConfirmationQuestion

Represents a yes/no question Enforces strict responses rather than non-standard answers counting as default Based on Symfony\Component\Console\Question\ConfirmationQuestion

Summary

Methods
Properties
Constants
__construct()
getQuestion()
getDefault()
isHidden()
setHidden()
isHiddenFallback()
setHiddenFallback()
getAutocompleterValues()
setAutocompleterValues()
setValidator()
getValidator()
setMaxAttempts()
getMaxAttempts()
setNormalizer()
getNormalizer()
No public properties found
No constants found
isAssoc()
No protected properties found
N/A
getDefaultNormalizer()
getDefaultValidator()
$question
$attempts
$hidden
$hiddenFallback
$autocompleterValues
$validator
$default
$normalizer
$trueAnswerRegex
$falseAnswerRegex
N/A

Properties

$question

$question : 

Type

$attempts

$attempts : 

Type

$hidden

$hidden : 

Type

$hiddenFallback

$hiddenFallback : 

Type

$autocompleterValues

$autocompleterValues : 

Type

$validator

$validator : 

Type

$default

$default : 

Type

$normalizer

$normalizer : 

Type

$trueAnswerRegex

$trueAnswerRegex : 

Type

$falseAnswerRegex

$falseAnswerRegex : 

Type

Methods

__construct()

__construct(string  $question, boolean  $default = true, string  $trueAnswerRegex = '/^y(?:es)?$/i', string  $falseAnswerRegex = '/^no?$/i') 

Constructor.s

Parameters

string $question

The question to ask to the user

boolean $default

The default answer to return, true or false

string $trueAnswerRegex

A regex to match the "yes" answer

string $falseAnswerRegex

A regex to match the "no" answer

getQuestion()

getQuestion() : string

Returns the question.

Returns

string

getDefault()

getDefault() : mixed

Returns the default answer.

Returns

mixed

isHidden()

isHidden() : boolean

Returns whether the user response must be hidden.

Returns

boolean

setHidden()

setHidden(boolean  $hidden) : $this

Sets whether the user response must be hidden or not.

Parameters

boolean $hidden

Throws

\Symfony\Component\Console\Exception\LogicException

In case the autocompleter is also used

Returns

$this

isHiddenFallback()

isHiddenFallback() : boolean

In case the response can not be hidden, whether to fallback on non-hidden question or not.

Returns

boolean

setHiddenFallback()

setHiddenFallback(boolean  $fallback) : $this

Sets whether to fallback on non-hidden question if the response can not be hidden.

Parameters

boolean $fallback

Returns

$this

getAutocompleterValues()

getAutocompleterValues() : \Symfony\Component\Console\Question\iterable|null

Gets values for the autocompleter.

Returns

\Symfony\Component\Console\Question\iterable|null

setAutocompleterValues()

setAutocompleterValues(\Symfony\Component\Console\Question\iterable|null  $values) : $this

Sets values for the autocompleter.

Parameters

\Symfony\Component\Console\Question\iterable|null $values

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException
\Symfony\Component\Console\Exception\LogicException

Returns

$this

setValidator()

setValidator(callable|null  $validator = null) : $this

Sets a validator for the question.

Parameters

callable|null $validator

Returns

$this

getValidator()

getValidator() : callable|null

Gets the validator for the question.

Returns

callable|null

setMaxAttempts()

setMaxAttempts(integer|null  $attempts) : $this

Sets the maximum number of attempts.

Null means an unlimited number of attempts.

Parameters

integer|null $attempts

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException

in case the number of attempts is invalid

Returns

$this

getMaxAttempts()

getMaxAttempts() : integer|null

Gets the maximum number of attempts.

Null means an unlimited number of attempts.

Returns

integer|null

setNormalizer()

setNormalizer(callable  $normalizer) : $this

Sets a normalizer for the response.

The normalizer can be a callable (a string), a closure or a class implementing __invoke.

Parameters

callable $normalizer

Returns

$this

getNormalizer()

getNormalizer() : callable

Gets the normalizer for the response.

The normalizer can ba a callable (a string), a closure or a class implementing __invoke.

Returns

callable

isAssoc()

isAssoc(  $array) 

Parameters

$array

getDefaultNormalizer()

getDefaultNormalizer() : callable

Returns the default answer normalizer.

Returns

callable

getDefaultValidator()

getDefaultValidator() : callable

Returns the default answer validator.

Returns

callable