\Horde_Argv_Option

Defines the Option class and some standard value-checking functions.

Instance attributes: shortOpts : [string] longOpts : [string]

action : string type : string dest : string default : any nargs : int const : any choices : [string] callback : function callbackArgs : (any*) help : string metavar : string

Summary

Methods
Properties
Constants
parseNumber()
checkBuiltin()
checkChoice()
__construct()
_checkAction()
_checkType()
_checkChoice()
_checkDest()
_checkConst()
_checkNargs()
_checkCallback()
__toString()
takesValue()
hasDefault()
getOptString()
checkValue()
convertValue()
process()
takeAction()
$NO_DEFAULT
$ATTRS
$ACTIONS
$STORE_ACTIONS
$TYPED_ACTIONS
$ALWAYS_TYPED_ACTIONS
$CONST_ACTIONS
$TYPES
$TYPE_CHECKER
$CHECK_METHODS
$shortOpts
$longOpts
$dest
$default
SUPPRESS_HELP
SUPPRESS_USAGE
_checkOptStrings()
_setOptStrings()
_setAttrs()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

SUPPRESS_HELP

SUPPRESS_HELP

SUPPRESS_USAGE

SUPPRESS_USAGE

Properties

$NO_DEFAULT

$NO_DEFAULT : 

Not supplying a default is different from a default of None, so we need an explicit 'not supplied' value.

Type

$ATTRS

$ATTRS : 

The list of instance attributes that may be set through keyword args to the constructor.

Type

$ACTIONS

$ACTIONS : 

The set of actions allowed by option parsers. Explicitly listed here so the constructor can validate its arguments.

Type

$STORE_ACTIONS

$STORE_ACTIONS : 

The set of actions that involve storing a value somewhere; also listed just for constructor argument validation. (If the action is one of these, there must be a destination.)

Type

$TYPED_ACTIONS

$TYPED_ACTIONS : 

The set of actions for which it makes sense to supply a value type, ie. which may consume an argument from the command line.

Type

$ALWAYS_TYPED_ACTIONS

$ALWAYS_TYPED_ACTIONS : 

The set of actions which *require* a value type, ie. that always consume an argument from the command line.

Type

$CONST_ACTIONS

$CONST_ACTIONS : 

The set of actions which take a 'const' attribute.

Type

$TYPES

$TYPES : 

The set of known types for option parsers.

Again, listed here for constructor argument validation.

Type

$TYPE_CHECKER

$TYPE_CHECKER : 

Dictionary of argument checking functions, which convert and validate option arguments according to the option type.

Signature of checking functions is:

mixed function(Horde_Argv_Option $option, string $opt, string $value)

where

  • $option is the Horde_Argv_Option instance calling the checker
  • $opt is the actual option seen on the command-line (eg. '-a', '--file')
  • $value is the option argument seen on the command-line

The return value should be in the appropriate PHP type for $option->type -- eg. an integer if $option->type == 'int'.

If no checker is defined for a type, arguments will be unchecked and remain strings.

Type

$CHECK_METHODS

$CHECK_METHODS : 

A list of unbound method objects.

They are called by the constructor, in order, after all attributes are initialized. The list is created and filled in later, after all the methods are actually defined. (I just put it here because I like to define and document all class attributes in the same place.) Subclasses that add another check*() method should define their own CHECK_METHODS list that adds their check method to those from this class.

Type

$shortOpts

$shortOpts : 

Type

$longOpts

$longOpts : 

Type

$dest

$dest : 

Type

$default

$default : 

Type

Methods

parseNumber()

parseNumber(  $value) 

Parameters

$value

checkBuiltin()

checkBuiltin(  $opt,   $value) 

Parameters

$opt
$value

checkChoice()

checkChoice(  $opt,   $value) 

Parameters

$opt
$value

__construct()

__construct() 

Constructor.

_checkAction()

_checkAction() 

_checkType()

_checkType() 

_checkChoice()

_checkChoice() 

_checkDest()

_checkDest() 

_checkConst()

_checkConst() 

_checkNargs()

_checkNargs() 

_checkCallback()

_checkCallback() 

__toString()

__toString() 

takesValue()

takesValue() 

hasDefault()

hasDefault() 

getOptString()

getOptString() 

checkValue()

checkValue(  $opt,   $value) 

Parameters

$opt
$value

convertValue()

convertValue(  $opt,   $value) 

Parameters

$opt
$value

process()

process(  $opt,   $value,   $values,   $parser) 

Parameters

$opt
$value
$values
$parser

takeAction()

takeAction(  $action,   $dest,   $opt,   $value,   $values,   $parser) 

Parameters

$action
$dest
$opt
$value
$values
$parser

_checkOptStrings()

_checkOptStrings(  $opts) 

Parameters

$opts

_setOptStrings()

_setOptStrings(  $opts) 

Parameters

$opts

_setAttrs()

_setAttrs(  $attrs) 

Parameters

$attrs