PHP 클래스 kahlan\cli\CommandLine

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

보호된 프로퍼티들

프로퍼티 타입 설명
$_defaults array Defaults options values
$_options array Arguments attributes
$_values array Arguments values.

공개 메소드들

메소드 설명
__construct ( array $options = [] ) The Constructor.
add ( string $name, mixed $value ) : array Adds a value to a specific option (or set if it's not an array).
cast ( string $value, string $type, boolean $array = false ) : array Casts a value according to the option attributes.
exists ( string $name ) : boolean Checks if an option has been setted.
get ( string $name = null ) : array Gets the value of a specific option.
option ( string $name = null, array $config = [], $value = null ) : array Gets/Sets/Overrides an option's attributes.
options ( ) : array Returns all options attributes.
parse ( array $argv, boolean $override = true ) : array Parses a command line argv.
set ( string $name, mixed $value ) : array Sets the value of a specific option.

보호된 메소드들

메소드 설명
_get ( string $name ) : array Helper for get().
_parse ( string $arg ) : array Helper for parse().
_splitOptionName ( string $name ) : array Helper to split option name

메소드 상세

__construct() 공개 메소드

The Constructor.
public __construct ( array $options = [] )
$options array An array of option's attributes where keys are option's names and values are an array of attributes.

_get() 보호된 메소드

Helper for get().
protected _get ( string $name ) : array
$name string The name of the option.
리턴 array The casted value.

_parse() 보호된 메소드

Helper for parse().
protected _parse ( string $arg ) : array
$arg string A string argument.
리턴 array The parsed argument

_splitOptionName() 보호된 메소드

Helper to split option name
protected _splitOptionName ( string $name ) : array
$name string The option name.
리턴 array

add() 공개 메소드

Adds a value to a specific option (or set if it's not an array).
public add ( string $name, mixed $value ) : array
$name string The name of the option.
$value mixed The value of the option to set.
리턴 array The setted value.

cast() 공개 메소드

Casts a value according to the option attributes.
public cast ( string $value, string $type, boolean $array = false ) : array
$value string The value to cast.
$type string The type of the value.
$array boolean If `true`, the argument value is considered to be an array.
리턴 array The casted value.

exists() 공개 메소드

Checks if an option has been setted.
public exists ( string $name ) : boolean
$name string The name of the option.
리턴 boolean

get() 공개 메소드

Gets the value of a specific option.
public get ( string $name = null ) : array
$name string The name of the option.
리턴 array The value.

option() 공개 메소드

Gets/Sets/Overrides an option's attributes.
public option ( string $name = null, array $config = [], $value = null ) : array
$name string The name of the option.
$config array The option attributes to set.
리턴 array

options() 공개 메소드

Returns all options attributes.
public options ( ) : array
리턴 array

parse() 공개 메소드

Parses a command line argv.
public parse ( array $argv, boolean $override = true ) : array
$argv array An argv data.
$override boolean If set to `false` it doesn't override already setted data.
리턴 array The parsed attributes

set() 공개 메소드

Sets the value of a specific option.
public set ( string $name, mixed $value ) : array
$name string The name of the option.
$value mixed The value of the option to set.
리턴 array The setted value.

프로퍼티 상세

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

Defaults options values
protected array $_defaults
리턴 array

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

Arguments attributes
protected array $_options
리턴 array

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

Arguments values.
protected array $_values
리턴 array