|
Previous Page |
Solar_Getopt |
Next Page |
Properties
Public
$options
(array) The array of acceptable options.
The $options array contains all options accepted by the
application, including their types, default values, descriptions,
requirements, and validation callbacks.
In general, you should not try to set $options yourself; instead, use Solar_Getopt::setOption() and/or Solar_Getopt::setOptions().
Protected
$_Solar_Getopt
(array) User-defined configuration values.
Keys are:
filter_class- (string) The data-filter class to use when validating and sanitizing parameter values. Default is 'Solar_Filter'.
strict- (bool) If true, will not process any more options after the first non-option-related parameter. This forces all numeric parameters to come after the last option. If false, numeric parameters unrelated to any particular option can be mixed in with the options.
$_argv
(array) The arguments passed in from the command line.
$_config
(array) Collection point for configuration values.
Inherited from Solar_Base.
Note that you do not define config defaults in $_config directly.
<?php
// DO NOT DO THIS
protected $_config = array(
'foo' => 'bar',
'baz' => 'dib',
);
?>
Instead, define config defaults in a protected property named for the class, withan underscore prefix.
For exmple, a "Vendor_Class_Name" class would define the default config array in "$_Vendor_Class_Name". This convention lets child classes inherit parent config keys and values.
<?php
// DO THIS INSTEAD
protected $_Vendor_Class_Name = array(
'foo' => 'bar',
'baz' => 'dib',
);
?>
$_default
(array) Default option settings.
Keys are ...
long- (string) The long-form of the option name (e.g., "--foo-bar" would be "foo-bar").
short- (string) The short-form of the option, if any (e.g., "-f" would be "f").
descr- (string) A description of the option (used in "help" output).
param- (string) When the option is present, does it take a parameter? If so, the param can be "required" every time, or be "optional". If empty, no parameter for the option will be recognized (the option's value will be boolean true when the option is present). Default is 'optional'.
value- (mixed) The default value for the option parameter, if any. This way, options not specified in the arguments can have a default value.
require- (bool) At validation time, the option must have a non-blank value of some sort.
filters- (array) An array of filters to apply to the parameter value. This can
be a single filter (
array('validateInt')), or a series of filters (array('validateInt', array('validateRange', -10, +10)).
$_filters
(array) List of filters to apply to option values.
$_invalid
(array) List of names for invalid option values, and error messages.
$_values
(array) Option values parsed from the arguments, as well as remaining (numeric) arguments.
Private
None.