PHP 클래스 GetOptionKit\Option

파일 보기 프로젝트 열기: c9s/getoptionkit 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$defaultValue
$desc the description of this option
$filter The filter closure of the option value.
$flag
$incremental
$isa * name for the value place holder, for printing
$isaOption
$key The option key
$long
$multiple
$optional
$required
$short
$suggestions
$type
$validValues
$validator
$value * key to store values
$valueName

보호된 프로퍼티들

프로퍼티 타입 설명
$trigger trigger callback after value is set.

공개 메소드들

메소드 설명
__construct ( $spec )
__toString ( )
defaultValue ( $value )
desc ( $desc )
filter ( $cb ) Set up a filter function for the option value.
flag ( )
getId ( ) * get the option key for result key mapping.
getSuggestions ( ) : string[] Return suggestions.
getTypeClass ( )
getValidValues ( ) : string[] Return valud values array.
getValue ( )
increaseValue ( ) This method is for incremental option.
incremental ( ) To make -v, -vv, -vvv works.
isFlag ( )
isIncremental ( )
isMultiple ( )
isOptional ( )
isRequired ( )
isType ( $type )
isTypeNumber ( )
isa ( string $type, mixed $option = null ) Value Type Setters.
multiple ( )
optional ( )
pushValue ( $value ) push option value, when the option accept multiple values.
renderReadableSpec ( string $renderHint = true ) get readable spec for printing.
renderValueHint ( )
required ( )
setValue ( $value ) * set option value
suggestions ( $suggestions ) Assign suggestions.
testValue ( $value )
trigger ( callable $trigger )
validValues ( $values ) Assign validValues to member value.
validate ( $value )
validator ( $cb )
valueName ( $name ) valueName is for option value hinting:.

보호된 메소드들

메소드 설명
_preprocessValue ( $value )
callTrigger ( )
initFromSpecString ( string $specString ) Build spec attributes from spec string.

메소드 상세

__construct() 공개 메소드

public __construct ( $spec )

__toString() 공개 메소드

public __toString ( )

_preprocessValue() 보호된 메소드

protected _preprocessValue ( $value )

callTrigger() 보호된 메소드

protected callTrigger ( )

defaultValue() 공개 메소드

public defaultValue ( $value )

desc() 공개 메소드

public desc ( $desc )

filter() 공개 메소드

todo: add "callable" type hint later.
public filter ( $cb )

flag() 공개 메소드

public flag ( )

getId() 공개 메소드

* get the option key for result key mapping.
public getId ( )

getSuggestions() 공개 메소드

Return suggestions.
public getSuggestions ( ) : string[]
리턴 string[] or nil

getTypeClass() 공개 메소드

public getTypeClass ( )

getValidValues() 공개 메소드

Return valud values array.
public getValidValues ( ) : string[]
리턴 string[] or nil

getValue() 공개 메소드

public getValue ( )

increaseValue() 공개 메소드

This method is for incremental option.
public increaseValue ( )

incremental() 공개 메소드

To make -v, -vv, -vvv works.
public incremental ( )

initFromSpecString() 보호된 메소드

Build spec attributes from spec string.
protected initFromSpecString ( string $specString )
$specString string

isFlag() 공개 메소드

public isFlag ( )

isIncremental() 공개 메소드

public isIncremental ( )

isMultiple() 공개 메소드

public isMultiple ( )

isOptional() 공개 메소드

public isOptional ( )

isRequired() 공개 메소드

public isRequired ( )

isType() 공개 메소드

public isType ( $type )

isTypeNumber() 공개 메소드

public isTypeNumber ( )

isa() 공개 메소드

Value Type Setters.
public isa ( string $type, mixed $option = null )
$type string the value type, valid values are 'number', 'string', 'file', 'boolean', you can also use your own value type name.
$option mixed option(s) for value type class (optionnal)

multiple() 공개 메소드

public multiple ( )

optional() 공개 메소드

public optional ( )

pushValue() 공개 메소드

push option value, when the option accept multiple values.
public pushValue ( $value )

renderReadableSpec() 공개 메소드

get readable spec for printing.
public renderReadableSpec ( string $renderHint = true )
$renderHint string render also value hint

renderValueHint() 공개 메소드

public renderValueHint ( )

required() 공개 메소드

public required ( )

setValue() 공개 메소드

* set option value
public setValue ( $value )

suggestions() 공개 메소드

Assign suggestions.
public suggestions ( $suggestions )

testValue() 공개 메소드

public testValue ( $value )

trigger() 공개 메소드

public trigger ( callable $trigger )
$trigger callable

validValues() 공개 메소드

Assign validValues to member value.
public validValues ( $values )

validate() 공개 메소드

public validate ( $value )

validator() 공개 메소드

public validator ( $cb )

valueName() 공개 메소드

--name=
public valueName ( $name )

프로퍼티 상세

$defaultValue 공개적으로 프로퍼티

public $defaultValue

$desc 공개적으로 프로퍼티

the description of this option
public $desc

$filter 공개적으로 프로퍼티

The filter closure of the option value.
public $filter

$flag 공개적으로 프로퍼티

public $flag

$incremental 공개적으로 프로퍼티

public $incremental

$isa 공개적으로 프로퍼티

* name for the value place holder, for printing
public $isa

$isaOption 공개적으로 프로퍼티

public $isaOption

$key 공개적으로 프로퍼티

The option key
public $key

$long 공개적으로 프로퍼티

public $long

$multiple 공개적으로 프로퍼티

public $multiple

$optional 공개적으로 프로퍼티

public $optional

$required 공개적으로 프로퍼티

public $required

$short 공개적으로 프로퍼티

public $short

$suggestions 공개적으로 프로퍼티

public $suggestions

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

trigger callback after value is set.
protected $trigger

$type 공개적으로 프로퍼티

public $type

$validValues 공개적으로 프로퍼티

public $validValues

$validator 공개적으로 프로퍼티

public $validator

$value 공개적으로 프로퍼티

* key to store values
public $value

$valueName 공개적으로 프로퍼티

public $valueName