Class CriticalI_Options

Description

Implements interfaces:

  • IteratorAggregate (internal interface)
  • ArrayAccess (internal interface)

Processes command line options.

Once options have been processed, the CriticalI_Options object can be treated as an array. Treating it as a numerically indexed list allows access to all options passed on the command line when an option is specified more than once. It can also be treated as an associative array with the option names as keys.

Located in /Core/lib/CriticalI/Options.php (line 55)


	
			
Variable Summary
 mixed $arguments
 mixed $hash
 mixed $options
 mixed $optionSpec
 mixed $scriptName
Method Summary
 CriticalI_Options __construct (array $args, array $optionSpec)
 void arguments ()
 void find_option_spec (string $name)
 ArrayIterator getIterator ()
 void is_next_option ()
 boolean offsetExists (string $idx)
 mixed offsetGet (string $idx)
 void offsetSet (string $idx, string $value)
 void offsetUnset (string $idx)
 void options_hash ()
 void parse_option (string $arg)
 void parse_option_optional_arg (string $name, string $optArg)
 void parse_option_prohibited_arg (string $name, string $optArg)
 void parse_option_required_arg (string $name, string $optArg)
 void script_name ()
Variables
mixed $arguments (line 56)
  • access: protected
mixed $hash (line 60)
  • access: protected
mixed $options (line 59)
  • access: protected
mixed $optionSpec (line 57)
  • access: protected
mixed $scriptName (line 58)
  • access: protected
Methods
Constructor __construct (line 70)

Constructor

The option specification is a list of CriticalI_OptionSpec objects.

  • access: public
CriticalI_Options __construct (array $args, array $optionSpec)
  • array $args: The argument list (first item is the script name, not an option)
  • array $optionSpec: Option specification list.
arguments (line 89)

Return the arguments that remain after processing

  • access: public
void arguments ()
find_option_spec (line 299)

Located the option spec for a named option

  • access: protected
void find_option_spec (string $name)
  • string $name: The option spec to find
getIterator (line 97)

Return an iterator for the options list

  • access: public
ArrayIterator getIterator ()

Implementation of:
IteratorAggregate::getIterator
is_next_option (line 209)

Peeks at the next argument to see if it is an option

  • access: protected
void is_next_option ()
offsetExists (line 106)

Tests for existence of an array index

  • access: public
boolean offsetExists (string $idx)
  • string $idx: The index to test

Implementation of:
ArrayAccess::offsetExists
offsetGet (line 122)

Retrieves the value at an array index. A numeric index returns a CriticalI_Option, a non-numeric index returns only the argument for the option.

  • return: The value for the given option or option index
  • access: public
mixed offsetGet (string $idx)
  • string $idx: The index to get

Implementation of:
ArrayAccess::offsetGet
offsetSet (line 136)

Sets the value at an array index

  • access: public
void offsetSet (string $idx, string $value)
  • string $idx: The index to set
  • string $value: The value to set

Implementation of:
ArrayAccess::offsetSet
offsetUnset (line 162)

Deletes an entry at an array index

  • access: public
void offsetUnset (string $idx)
  • string $idx: The index to unset

Implementation of:
ArrayAccess::offsetUnset
options_hash (line 181)

Provides internal access to the options hash

  • access: protected
void options_hash ()
parse_option (line 220)

Parses an option

  • access: protected
void parse_option (string $arg)
  • string $arg: The current argument
parse_option_optional_arg (line 268)

Handle an option which may take an optional argument

  • access: protected
void parse_option_optional_arg (string $name, string $optArg)
  • string $name: The option name
  • string $optArg: The attached argument, if supplied (i.e. if provided as name=arg)
parse_option_prohibited_arg (line 286)

Handle an option which may not have an argument

  • access: protected
void parse_option_prohibited_arg (string $name, string $optArg)
  • string $name: The option name
  • string $optArg: The attached argument, if supplied (i.e. if provided as name=arg)
parse_option_required_arg (line 250)

Handle an option which requires an argument

  • access: protected
void parse_option_required_arg (string $name, string $optArg)
  • string $name: The option name
  • string $optArg: The attached argument, if supplied (i.e. if provided as name=arg)
process_arguments (line 196)

Process the arguments

  • access: protected
void process_arguments ()
script_name (line 82)

Return the script name

  • access: public
void script_name ()

Documentation generated on Wed, 25 Apr 2012 09:46:43 -0700 by phpDocumentor 1.4.3