PHP 클래스 think\console\input\Option

파일 보기 프로젝트 열기: top-think/framework 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $name, string | array $shortcut = null, integer $mode = null, string $description = '', mixed $default = null ) 构造方法
acceptValue ( ) : boolean 是否可以设置值
equals ( Option $option ) : boolean 检查所给选项是否是当前这个
getDefault ( ) : mixed 获取默认值
getDescription ( ) : string 获取描述文字
getName ( ) : string 获取选项名
getShortcut ( ) : string 获取短名称
isArray ( ) : boolean 选项值是否接受数组
isValueOptional ( ) : boolean 是否可选
isValueRequired ( ) : boolean 是否必须
setDefault ( mixed $default = null ) 设置默认值

메소드 상세

__construct() 공개 메소드

构造方法
public __construct ( string $name, string | array $shortcut = null, integer $mode = null, string $description = '', mixed $default = null )
$name string 选项名
$shortcut string | array 短名称,多个用|隔开或者使用数组
$mode integer 选项类型(可选类型为 self::VALUE_*)
$description string 描述
$default mixed 默认值 (类型为 self::VALUE_REQUIRED 或者 self::VALUE_NONE 的时候必须为null)

acceptValue() 공개 메소드

是否可以设置值
public acceptValue ( ) : boolean
리턴 boolean 类型不是 self::VALUE_NONE 的时候返回true,其他均返回false

equals() 공개 메소드

检查所给选项是否是当前这个
public equals ( Option $option ) : boolean
$option Option
리턴 boolean

getDefault() 공개 메소드

获取默认值
public getDefault ( ) : mixed
리턴 mixed

getDescription() 공개 메소드

获取描述文字
public getDescription ( ) : string
리턴 string

getName() 공개 메소드

获取选项名
public getName ( ) : string
리턴 string

getShortcut() 공개 메소드

获取短名称
public getShortcut ( ) : string
리턴 string

isArray() 공개 메소드

选项值是否接受数组
public isArray ( ) : boolean
리턴 boolean 类型是 self::VALUE_IS_ARRAY 的时候返回true,其他均返回false

isValueOptional() 공개 메소드

是否可选
public isValueOptional ( ) : boolean
리턴 boolean 类型是 self::VALUE_OPTIONAL 的时候返回true,其他均返回false

isValueRequired() 공개 메소드

是否必须
public isValueRequired ( ) : boolean
리턴 boolean 类型是 self::VALUE_REQUIRED 的时候返回true,其他均返回false

setDefault() 공개 메소드

设置默认值
public setDefault ( mixed $default = null )
$default mixed 默认值