Class SimpleArguments

Description

Parses the command line arguments.

Located in /arguments.php (line 14)


	
			
Method Summary
 SimpleArguments __construct (array $arguments)
 hash all ()
 void assign (string $key, string $value)
 boolean isFlag (string $argument)
 void valueIsNext (array $arguments)
 string/array/boolean __get (string $key)
Methods
Constructor __construct (line 28)

Parses the command line arguments. The usual formats

are supported: -f value -f=value --flag=value --flag value -f (true) --flag (true)

SimpleArguments __construct (array $arguments)
  • array $arguments: Normally the PHP $argv.
all (line 128)

The entire argument set as a hash.

  • return: Each argument and it's value(s).
hash all ()
assign (line 44)

Sets the value in the argments object. If multiple values are added under the same key, the key will give an array value in the order they were added.

void assign (string $key, string $value)
  • string $key: The variable to assign to.
  • string $value: value The value that would norally be colected on the command line.
isFlag (line 103)

It's a flag if it starts with "-" or "--".

  • return: True if it's a flag.
boolean isFlag (string $argument)
  • string $argument: Value to be tested.
valueIsNext (line 94)

Test to see if the next available argument is a valid value.

If it starts with "-" or "--" it's a flag and doesn't count.

void valueIsNext (array $arguments)
  • array $arguments: Remaining arguments to be parsed. Not affected by this call. boolean True if valid value.
__get (line 117)

The arguments are available as individual member variables on the object.

  • return: Either false for no value, the value as a string or a list of multiple values if the flag had been specified more than once.
string/array/boolean __get (string $key)
  • string $key: Argument name.

Documentation generated on Sun, 31 Oct 2010 16:30:53 -0500 by phpDocumentor 1.4.3