[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/src/ -> lmbTestGetopt.class.php (summary)

Class based on PEAR Console_Getopt, it's main goal is to remove any external dependencies from TESTS_RUNNER package

File Size: 298 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

lmbTestGetopt:: (9 methods):
  getopt2()
  getopt()
  defineConstants()
  doGetopt()
  _parseShortOption()
  _isShortOpt()
  _isLongOpt()
  _parseLongOption()
  readPHPArgv()


Class: lmbTestGetopt  - X-Ref

Command-line options parsing class.

getopt2($args, $short_options, $long_options = null)   X-Ref
Parses the command-line options.

The first parameter to this function should be the list of command-line
arguments without the leading reference to the running program.

The second parameter is a string of allowed short options. Each of the
option letters can be followed by a colon ':' to specify that the option
requires an argument, or a double colon '::' to specify that the option
takes an optional argument.

The third argument is an optional array of allowed long options. The
leading '--' should not be included in the option name. Options that
require an argument should be followed by '=', and options that take an
option argument should be followed by '=='.

The return value is an array of two elements: the list of parsed
options and the list of non-option command-line arguments. Each entry in
the list of parsed options is a pair of elements - the first one
specifies the option, and the second one specifies the option argument,
if there was one.

Long and short options can be mixed.

Most of the semantics of this function are based on GNU getopt_long().

param: array  $args           an array of command-line arguments
param: string $short_options  specifies the list of allowed short options
param: array  $long_options   specifies the list of allowed long options
return: array two-element array containing the list of parsed options and

getopt($args, $short_options, $long_options = null)   X-Ref
This function expects $args to start with the script name (POSIX-style).
Preserved for backwards compatibility.


defineConstants($argv)   X-Ref
No description

doGetopt($version, $args, $short_options, $long_options = null)   X-Ref
The actual implementation of the argument parsing code.


_parseShortOption($arg, $short_options, &$opts, &$args)   X-Ref


_isShortOpt($arg)   X-Ref


_isLongOpt($arg)   X-Ref


_parseLongOption($arg, $long_options, &$opts, &$args)   X-Ref


readPHPArgv()   X-Ref
Safely read the $argv PHP array across different PHP configurations.
Will take care on register_globals and register_argc_argv ini directives

return: mixed the $argv PHP array or PEAR error if not registered



Generated: Tue Dec 2 03:54:09 2008 Cross-referenced by PHPXref 0.7