PHP 클래스 SimpleArguments, simpletest

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

공개 메소드들

메소드 설명
__construct ( array $arguments ) Parses the command line arguments.
__get ( string $key ) : string/array/boolean The arguments are available as individual member variables on the object.
all ( ) : hash The entire argument set as a hash.
assign ( string $key, $value ) Sets the value in the argments object. If multiple values are added under the same key, the key will give an array value in the order they were added.
isFlag ( string $argument ) : boolean It's a flag if it starts with "-" or "--".
valueIsNext ( array $arguments ) Test to see if the next available argument is a valid value.

비공개 메소드들

메소드 설명
nextNonFlagElseTrue ( array &$arguments ) : string/boolean Attempts to use the next argument as a value.
parseArgument ( array &$arguments ) : array Extracts the next key and value from the argument list.

메소드 상세

__construct() 공개 메소드

The usual formats are supported: -f value -f=value --flag=value --flag value -f (true) --flag (true)
public __construct ( array $arguments )
$arguments array Normally the PHP $argv.

__get() 공개 메소드

The arguments are available as individual member variables on the object.
public __get ( string $key ) : string/array/boolean
$key string Argument name.
리턴 string/array/boolean

all() 공개 메소드

The entire argument set as a hash.
public all ( ) : hash
리턴 hash Each argument and it's value(s).

assign() 공개 메소드

Sets the value in the argments object. If multiple values are added under the same key, the key will give an array value in the order they were added.
public assign ( string $key, $value )
$key string The variable to assign to.

isFlag() 공개 메소드

It's a flag if it starts with "-" or "--".
public isFlag ( string $argument ) : boolean
$argument string Value to be tested.
리턴 boolean True if it's a flag.

valueIsNext() 공개 메소드

If it starts with "-" or "--" it's a flag and doesn't count.
public valueIsNext ( array $arguments )
$arguments array Remaining arguments to be parsed. Not affected by this call. boolean True if valid value.