Verify arguments for wsh programs. More...
Public Member Functions | |
__construct () | |
setText ($text) | |
setDefinitionText ($text) | |
addHidden ($argName, $argDefinition) | |
addHiddenParameter ($argName, $argDefinition) | |
addNeeded ($argName, $argDefinition, array $restriction=null) | |
addRequiredParameter ($argName, $argDefinition, $restriction=null) | |
addOption ($argName, $argDefinition, array $restriction=null, $default=null) | |
addOptionalParameter ($argName, $argDefinition, $restriction=null, $default=null) | |
addEmpty ($argName, $argDefinition="") | |
addEmptyParameter ($argName, $argDefinition="") | |
getUsage () | |
exitError ($error= '') | |
strict ($strict=true) | |
if false additionnal arguments are ignored, default is true More... | |
setStrictMode ($strict=true) | |
if false additionnal arguments are ignored, default is true More... | |
verify ($useException=false) | |
Static Public Member Functions | |
static | isScalar ($argVal, $argName, $apiUsage) |
static | isArray ($argVal, $argName, $apiUsage) |
static | matchValues ($value, $restrictions) |
Data Fields | |
const | THROW_EXITHELP = 1988 |
const | GET_USAGE = null |
Protected Member Functions | |
getArgumentValue ($key, $defaultValue= '') | |
isCallable ($f) | |
getHiddenKeys () | |
Protected Attributes | |
$action | |
$strict = true | |
$useException = false | |
Verify arguments for wsh programs.
Verify arguments for wsh programs
Definition at line 28 of file Class.ApiUsage.php.
__construct | ( | ) |
init action
Definition at line 83 of file Class.ApiUsage.php.
addEmpty | ( | $argName, | |
$argDefinition = "" |
|||
) |
add empty argument (argument with boolean value)
string | $argName | argument name |
string | $argDefinition | argument definition |
Definition at line 276 of file Class.ApiUsage.php.
addEmptyParameter | ( | $argName, | |
$argDefinition = "" |
|||
) |
add empty argument (argument with boolean value)
string | $argName | argument name |
string | $argDefinition | argument definition |
Definition at line 291 of file Class.ApiUsage.php.
addHidden | ( | $argName, | |
$argDefinition | |||
) |
add hidden argument (private arg not see them in usage)
string | $argName | argument name |
string | $argDefinition | argument définition |
Definition at line 162 of file Class.ApiUsage.php.
addHiddenParameter | ( | $argName, | |
$argDefinition | |||
) |
add hidden argument (private arg not see them in usage)
string | $argName | argument name |
string | $argDefinition | argument définition |
Definition at line 177 of file Class.ApiUsage.php.
addNeeded | ( | $argName, | |
$argDefinition, | |||
array | $restriction = null |
||
) |
add needed argument
string | $argName | argument name |
string | $argDefinition | argument définition |
array | $restriction | optional enumeration for argument |
Definition at line 198 of file Class.ApiUsage.php.
addOption | ( | $argName, | |
$argDefinition, | |||
array | $restriction = null , |
||
$default = null |
|||
) |
add optional argument
string | $argName | argument name |
string | $argDefinition | argument définition |
array | $restriction | optional enumeration for argument |
string | $default | default value if no value set |
Definition at line 237 of file Class.ApiUsage.php.
addOptionalParameter | ( | $argName, | |
$argDefinition, | |||
$restriction = null , |
|||
$default = null |
|||
) |
add optional argument
string | $argName | argument name |
string | $argDefinition | argument definition |
array | callable | $restriction | optional enumeration for argument |
string | $default | default value if no value set |
Definition at line 254 of file Class.ApiUsage.php.
addRequiredParameter | ( | $argName, | |
$argDefinition, | |||
$restriction = null |
|||
) |
add needed argument
string | $argName | argument name |
string | $argDefinition | argument définition |
array | callable | $restriction | optional enumeration for argument |
Definition at line 214 of file Class.ApiUsage.php.
exitError | ( | $error = '' | ) |
exit when error
string | $error | message error |
Dcp\ApiUsage\Exception |
Definition at line 383 of file Class.ApiUsage.php.
|
protected |
Return value of argument key
string | $key | the identifier |
string | $defaultValue | value to return if value is empty |
Definition at line 307 of file Class.ApiUsage.php.
|
protected |
getUsage | ( | ) |
|
static |
Restriction callback to verify an array value
string | $argVal | argument value |
string | $argName | argument name |
ApiUsage | $apiUsage | current apiUsage object |
Definition at line 117 of file Class.ApiUsage.php.
|
protected |
Definition at line 341 of file Class.ApiUsage.php.
|
static |
Restriction callback to verify a scalar value
string | $argVal | argument value |
string | $argName | argument name |
ApiUsage | $apiUsage | current apiUsage object |
Definition at line 98 of file Class.ApiUsage.php.
|
static |
setDefinitionText | ( | $text | ) |
add textual definition of program
string | $text | usage text |
Definition at line 146 of file Class.ApiUsage.php.
setStrictMode | ( | $strict = true | ) |
if false additionnal arguments are ignored, default is true
set strict mode
boolean | $strict | strict mode |
Definition at line 449 of file Class.ApiUsage.php.
setText | ( | $text | ) |
add textual definition of program
string | $text | usage text |
Definition at line 133 of file Class.ApiUsage.php.
strict | ( | $strict = true | ) |
if false additionnal arguments are ignored, default is true
set strict mode
boolean | $strict | strict mode |
Definition at line 434 of file Class.ApiUsage.php.
verify | ( | $useException = false | ) |
verify if wsh program argument are valids. If not wsh exit
bool | $useException | if true throw ApiUsageException when verify is not successful |
Definition at line 461 of file Class.ApiUsage.php.
|
protected |
Definition at line 67 of file Class.ApiUsage.php.
|
protected |
Definition at line 73 of file Class.ApiUsage.php.
|
protected |
Definition at line 79 of file Class.ApiUsage.php.
const GET_USAGE = null |
Definition at line 31 of file Class.ApiUsage.php.
const THROW_EXITHELP = 1988 |
Definition at line 30 of file Class.ApiUsage.php.