PHP Class think\console\output\Question

Datei anzeigen Open project: top-think/framework Class Usage Examples

Public Methods

Method Description
__construct ( string $question, mixed $default = null ) 构造方法
getAutocompleterValues ( ) : null | array | Traversable 获取自动完成
getDefault ( ) : mixed 获取默认答案
getMaxAttempts ( ) : null | integer 获取最大重试次数
getNormalizer ( ) : string | Closure 获取响应回调 The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
getQuestion ( ) : string 获取问题
getValidator ( ) : null | callable 获取验证器
isHidden ( ) : boolean 是否隐藏答案
isHiddenFallback ( ) : boolean 不能被隐藏是否撤销
setAutocompleterValues ( null | array | Traversable $values ) : Question 设置自动完成的值
setHidden ( boolean $hidden ) : Question 隐藏答案
setHiddenFallback ( boolean $fallback ) : Question 设置不能被隐藏的时候的操作
setMaxAttempts ( null | integer $attempts ) : Question 设置最大重试次数
setNormalizer ( string | Closure $normalizer ) : Question 设置响应的回调
setValidator ( null | callable $validator ) : Question 设置答案的验证器

Protected Methods

Method Description
isAssoc ( $array )

Method Details

__construct() public method

构造方法
public __construct ( string $question, mixed $default = null )
$question string 问题
$default mixed 默认答案

getAutocompleterValues() public method

获取自动完成

getDefault() public method

获取默认答案
public getDefault ( ) : mixed
return mixed

getMaxAttempts() public method

获取最大重试次数
public getMaxAttempts ( ) : null | integer
return null | integer

getNormalizer() public method

获取响应回调 The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
public getNormalizer ( ) : string | Closure
return string | Closure

getQuestion() public method

获取问题
public getQuestion ( ) : string
return string

getValidator() public method

获取验证器
public getValidator ( ) : null | callable
return null | callable

isAssoc() protected method

protected isAssoc ( $array )

isHidden() public method

是否隐藏答案
public isHidden ( ) : boolean
return boolean

isHiddenFallback() public method

不能被隐藏是否撤销
public isHiddenFallback ( ) : boolean
return boolean

setAutocompleterValues() public method

设置自动完成的值
public setAutocompleterValues ( null | array | Traversable $values ) : Question
$values null | array | Traversable
return Question

setHidden() public method

隐藏答案
public setHidden ( boolean $hidden ) : Question
$hidden boolean
return Question

setHiddenFallback() public method

设置不能被隐藏的时候的操作
public setHiddenFallback ( boolean $fallback ) : Question
$fallback boolean
return Question

setMaxAttempts() public method

设置最大重试次数
public setMaxAttempts ( null | integer $attempts ) : Question
$attempts null | integer
return Question

setNormalizer() public method

设置响应的回调
public setNormalizer ( string | Closure $normalizer ) : Question
$normalizer string | Closure
return Question

setValidator() public method

设置答案的验证器
public setValidator ( null | callable $validator ) : Question
$validator null | callable
return Question The current instance