PHP Class think\console\output\question\Choice

Inheritance: extends think\console\output\Question
Exibir arquivo Open project: top-think/framework

Public Methods

Method Description
__construct ( string $question, array $choices, mixed $default = null ) 构造方法
getChoices ( ) : array 可选项
getPrompt ( ) : string 获取提示
isMultiselect ( )
setErrorMessage ( string $errorMessage ) : self 设置错误提示信息
setMultiselect ( boolean $multiselect ) : self 设置可否多选
setPrompt ( string $prompt ) : self 设置提示

Private Methods

Method Description
getDefaultValidator ( ) : callable 获取默认的验证方法

Method Details

__construct() public method

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

getChoices() public method

可选项
public getChoices ( ) : array
return array

getPrompt() public method

获取提示
public getPrompt ( ) : string
return string

isMultiselect() public method

public isMultiselect ( )

setErrorMessage() public method

设置错误提示信息
public setErrorMessage ( string $errorMessage ) : self
$errorMessage string
return self

setMultiselect() public method

设置可否多选
public setMultiselect ( boolean $multiselect ) : self
$multiselect boolean
return self

setPrompt() public method

设置提示
public setPrompt ( string $prompt ) : self
$prompt string
return self