PHP 클래스 think\console\Input

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

보호된 프로퍼티들

프로퍼티 타입 설명
$arguments think\console\input\Argument[]
$definition think\console\input\Definition
$interactive
$options think\console\input\Option[]

공개 메소드들

메소드 설명
__construct ( $argv = null )
__toString ( ) : string 返回传递给命令的参数的字符串
bind ( Definition $definition ) 绑定实例
escapeToken ( string $token ) : string 转义指令
getArgument ( string $name ) : mixed 根据名称获取参数
getArguments ( ) : Argument[] 获取所有的参数
getFirstArgument ( ) : string | null 获取第一个参数
getOption ( string $name ) : mixed 获取选项值
getOptions ( ) : Option[] 获取所有的选项
getParameterOption ( string | array $values, mixed $default = false ) : mixed 获取原始选项的值
hasArgument ( string | integer $name ) : boolean 检查是否存在某个参数
hasOption ( string $name ) : boolean 是否有某个选项
hasParameterOption ( string | array $values ) : boolean 检查原始参数是否包含某个值
isInteractive ( ) : boolean 检查输入是否是交互的
setArgument ( string $name, string $value ) 设置参数的值
setInteractive ( $interactive ) 设置输入的交互
setOption ( string $name, string | boolean $value ) 设置选项值
validate ( ) 验证输入

보호된 메소드들

메소드 설명
parse ( ) 解析参数
setTokens ( array $tokens )

비공개 메소드들

메소드 설명
addLongOption ( string $name, mixed $value ) 添加一个完整选项的值
addShortOption ( string $shortcut, mixed $value ) 添加一个短选项的值
parseArgument ( string $token ) 解析参数
parseLongOption ( string $token ) 解析完整选项
parseShortOption ( string $token ) 解析短选项
parseShortOptionSet ( string $name ) 解析短选项

메소드 상세

__construct() 공개 메소드

public __construct ( $argv = null )

__toString() 공개 메소드

返回传递给命令的参数的字符串
public __toString ( ) : string
리턴 string

bind() 공개 메소드

绑定实例
public bind ( Definition $definition )
$definition think\console\input\Definition A InputDefinition instance

escapeToken() 공개 메소드

转义指令
public escapeToken ( string $token ) : string
$token string
리턴 string

getArgument() 공개 메소드

根据名称获取参数
public getArgument ( string $name ) : mixed
$name string 参数名
리턴 mixed

getArguments() 공개 메소드

获取所有的参数
public getArguments ( ) : Argument[]
리턴 think\console\input\Argument[]

getFirstArgument() 공개 메소드

获取第一个参数
public getFirstArgument ( ) : string | null
리턴 string | null

getOption() 공개 메소드

获取选项值
public getOption ( string $name ) : mixed
$name string 选项名称
리턴 mixed

getOptions() 공개 메소드

获取所有的选项
public getOptions ( ) : Option[]
리턴 think\console\input\Option[]

getParameterOption() 공개 메소드

获取原始选项的值
public getParameterOption ( string | array $values, mixed $default = false ) : mixed
$values string | array 需要检查的值
$default mixed 默认值
리턴 mixed The option value

hasArgument() 공개 메소드

检查是否存在某个参数
public hasArgument ( string | integer $name ) : boolean
$name string | integer 参数名或位置
리턴 boolean

hasOption() 공개 메소드

是否有某个选项
public hasOption ( string $name ) : boolean
$name string 选项名
리턴 boolean

hasParameterOption() 공개 메소드

检查原始参数是否包含某个值
public hasParameterOption ( string | array $values ) : boolean
$values string | array 需要检查的值
리턴 boolean

isInteractive() 공개 메소드

检查输入是否是交互的
public isInteractive ( ) : boolean
리턴 boolean

parse() 보호된 메소드

解析参数
protected parse ( )

setArgument() 공개 메소드

设置参数的值
public setArgument ( string $name, string $value )
$name string 参数名
$value string

setInteractive() 공개 메소드

设置输入的交互
public setInteractive ( $interactive )

setOption() 공개 메소드

设置选项值
public setOption ( string $name, string | boolean $value )
$name string 选项名
$value string | boolean

setTokens() 보호된 메소드

protected setTokens ( array $tokens )
$tokens array

validate() 공개 메소드

验证输入
public validate ( )

프로퍼티 상세

$arguments 보호되어 있는 프로퍼티

protected Argument[],think\console\input $arguments
리턴 think\console\input\Argument[]

$definition 보호되어 있는 프로퍼티

protected Definition,think\console\input $definition
리턴 think\console\input\Definition

$interactive 보호되어 있는 프로퍼티

protected $interactive

$options 보호되어 있는 프로퍼티

protected Option[],think\console\input $options
리턴 think\console\input\Option[]