PHP Class Flitch\Cli\ArgumentParser

This is a PHP port of Arg_Parser, based on version 1.7.
Show file Open project: dasprid/flitch Class Usage Examples

Protected Properties

Property Type Description
$error string Error during argument parsing.
$nonOptions array Parsed non-options.
$options array Parsed options.

Public Methods

Method Description
__construct ( array $arguments, array $options ) : void Parse command line arguments.
getError ( ) : string Get parser error.
getNonOptions ( ) : array Get all parsed non-options.
getOptions ( ) : array Get all parsed options.

Protected Methods

Method Description
parseLongOption ( string $option, string $argument, array $options, integer &$argumentIndex ) : boolean Parse a long option.
parseShortOption ( string $option, string $argument, array $options, integer &$argumentIndex ) : boolean Parse a short option.

Method Details

__construct() public method

Parse command line arguments.
public __construct ( array $arguments, array $options ) : void
$arguments array
$options array
return void

getError() public method

Get parser error.
public getError ( ) : string
return string

getNonOptions() public method

Get all parsed non-options.
public getNonOptions ( ) : array
return array

getOptions() public method

Get all parsed options.
public getOptions ( ) : array
return array

parseLongOption() protected method

Parse a long option.
protected parseLongOption ( string $option, string $argument, array $options, integer &$argumentIndex ) : boolean
$option string
$argument string
$options array
$argumentIndex integer
return boolean

parseShortOption() protected method

Parse a short option.
protected parseShortOption ( string $option, string $argument, array $options, integer &$argumentIndex ) : boolean
$option string
$argument string
$options array
$argumentIndex integer
return boolean

Property Details

$error protected property

Error during argument parsing.
protected string $error
return string

$nonOptions protected property

Parsed non-options.
protected array $nonOptions
return array

$options protected property

Parsed options.
protected array $options
return array