Properties

$question

$question

$attempts

$attempts

$hidden

$hidden

$hiddenFallback

$hiddenFallback

$autocompleterValues

$autocompleterValues

$validator

$validator

$default

$default

$normalizer

$normalizer

Methods

__construct()

__construct(string  $question, mixed  $default = null) : mixed

构造方法

Parameters

string $question

问题

mixed $default

默认答案

Returns

mixed —

getQuestion()

getQuestion() : string

获取问题

Returns

string —

getDefault()

getDefault() : mixed

获取默认答案

Returns

mixed —

isHidden()

isHidden() : bool

是否隐藏答案

Returns

bool —

setHidden()

setHidden(bool  $hidden) : \think\console\output\Question

隐藏答案

Parameters

bool $hidden

Returns

\think\console\output\Question —

isHiddenFallback()

isHiddenFallback() : bool

不能被隐藏是否撤销

Returns

bool —

setHiddenFallback()

setHiddenFallback(bool  $fallback) : \think\console\output\Question

设置不能被隐藏的时候的操作

Parameters

bool $fallback

Returns

\think\console\output\Question —

getAutocompleterValues()

getAutocompleterValues() : null|array|\Traversable

获取自动完成

Returns

null|array|\Traversable —

setAutocompleterValues()

setAutocompleterValues(null|array|\Traversable  $values) : \think\console\output\Question

设置自动完成的值

Parameters

null|array|\Traversable $values

Throws

\InvalidArgumentException
\LogicException

Returns

\think\console\output\Question —

setValidator()

setValidator(null|callable  $validator) : \think\console\output\Question

设置答案的验证器

Parameters

null|callable $validator

Returns

\think\console\output\Question —

The current instance

getValidator()

getValidator() : null|callable

获取验证器

Returns

null|callable —

setMaxAttempts()

setMaxAttempts(null|int  $attempts) : \think\console\output\Question

设置最大重试次数

Parameters

null|int $attempts

Throws

\InvalidArgumentException

Returns

\think\console\output\Question —

getMaxAttempts()

getMaxAttempts() : null|int

获取最大重试次数

Returns

null|int —

setNormalizer()

setNormalizer(string|\Closure  $normalizer) : \think\console\output\Question

设置响应的回调

Parameters

string|\Closure $normalizer

Returns

\think\console\output\Question —

getNormalizer()

getNormalizer() : string|\Closure

获取响应回调 The normalizer can ba a callable (a string), a closure or a class implementing __invoke.

Returns

string|\Closure —

isAssoc()

isAssoc(mixed  $array) : mixed

Parameters

mixed $array

Returns

mixed —