[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> cliopts.php (summary)

Brutally chopped and modified from http://pear.php.net/package/Console_Getopts PHP Version 5

Author: Andrei Zmievski
License: http://www.opensource.org/licenses/bsd-license.php New BSD License
Link: http://pear.php.net/package/Console_Getopt
Version: CVS: $Id$
File Size: 512 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

Doku_Cli_Opts:: (10 methods):
  getopt2()
  getopt()
  doGetopt()
  _parseShortOption()
  _isShortOpt()
  _isLongOpt()
  _parseLongOption()
  readPHPArgv()
  raiseError()
  isError()

Doku_Cli_Opts_Error:: (3 methods):
  __construct()
  getMessage()
  isError()

Doku_Cli_Opts_Container:: (7 methods):
  __construct()
  has()
  get()
  arg()
  numArgs()
  hasArgs()
  isError()


Class: Doku_Cli_Opts  - X-Ref

Command-line options parsing class.

getopt2($args, $short_options, $long_options = null)   X-Ref
No description

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.

return: array two-element array containing the list of parsed options and
see: getopt2()
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

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

return: array
param: int    $version       Version to use
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

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

return: void|Doku_Cli_Opts_Error
param: string     $arg           Argument
param: string     $short_options Available short options
param: string[][] &$opts
param: string[]   &$args

_isShortOpt($arg)   X-Ref
Checks if an argument is a short option

return: bool
param: string $arg Argument to check

_isLongOpt($arg)   X-Ref
Checks if an argument is a long option

return: bool
param: string $arg Argument to check

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

return: void|Doku_Cli_Opts_Error
param: string     $arg          Argument
param: string[]   $long_options Available long options
param: string[][] &$opts
param: string[]   &$args

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: array|Doku_Cli_Opts_Error the $argv PHP array or PEAR error if not registered

raiseError($code, $msg)   X-Ref

return: Doku_Cli_Opts_Error
param: $code
param: $msg

isError($obj)   X-Ref

return: bool
param: $obj

Class: Doku_Cli_Opts_Error  - X-Ref

__construct($code, $msg)   X-Ref
No description

getMessage()   X-Ref
No description

isError()   X-Ref
No description

Class: Doku_Cli_Opts_Container  - X-Ref

__construct($options)   X-Ref
No description

has($option)   X-Ref
No description

get($option)   X-Ref
No description

arg($index)   X-Ref
No description

numArgs()   X-Ref
No description

hasArgs()   X-Ref
No description

isError()   X-Ref
No description



Generated: Mon Apr 18 03:00:10 2016 Cross-referenced by PHPXref 0.7