Class Option
Class for bettwer work with one PHP comman-line option
public
|
#
__construct(
string
$name
)
Set name of option and default short and long variant in command-line
Set name of option and default short and long variant in command-line Parameters
ThrowsTodo
accept array as second parameere for setting all object
|
public static
|
|
public static
|
#
__callStatic(
string
$type,
array
$settings
)
Create new option of specific type. The typed option have required value as
default.
Create new option of specific type. The typed option have required value as default. Parameters
ReturnsSee |
public static
|
#
registerType(
string
$name,
string
$className,
string
$classPath
)
Register new type. It has to by child of abstract class AType. It is possible
rewrite already registered types (so defaults too).
Register new type. It has to by child of abstract class AType. It is possible rewrite already registered types (so defaults too). Parameters
|
public
|
#
short(
string
$short = NULL
)
Set short variant of option in command-line
Set short variant of option in command-line Parameters
ReturnsThrows
Short and long varint cannot be undefined together.
Short variant have to be only one character. |
public
|
|
public
|
#
defaults(
mixed
$defaults = NULL
)
Set default value of option
Set default value of option Parameters
ReturnsThrows
The default value makes sense only for options with optional value or optional option with optional or required value. |
public
|
#
required(
boolean
$required = TRUE
)
Set flag of requirement of option
Set flag of requirement of option Parameters
ReturnsThrows
The required option does not make sense for option with default value and required value |
public
|
|
public
|
|
public
|
#
dependences(
array
$needed
)
Set needed options by this option
Set needed options by this option Parameters
|
public
string
|
|
public
string
|
|
public
string
|
|
public
mixed
|
#
getDefaults(
)
Return default value of option in command-line
Return default value of option in command-line Returnsmixed |
public
mixed
|
#
getValue(
boolean
$isDefaultSet = FALSE
)
Return value of option FALSE = not set TRUE = set without value other = value
form command-line of default value
Return value of option FALSE = not set TRUE = set without value other = value form command-line of default value Parameters
Returnsmixed |
public
string
|
#
getOptions(
string
$value = ''
)
Return short and long option in one string
Return short and long option in one string Parameters
Returnsstring |
public
string
|
string
|
VALUE_NO
|
'value_no' |
|
string
|
VALUE_REQUIRE
|
'value_require' |
|
string
|
VALUE_OPTIONAL
|
'value_optional' |
|
integer
|
HELP_INDENT_LENGTH
|
4 |