The third parameter to the Zend_Console_Getopt
constructor is an array of configuration options that affect
the behavior of the object instance returned. You can also
specify configuration options using the setOptions()
method, or you can set an individual option using the
setOption() method.
Clarifying the Term "option"
The term "option" is used for configuration of the
Zend_Console_Getopt class to match terminology
used elsewhere in Zend Framework. These are not the same
things as the command-line options that are parsed by
the Zend_Console_Getopt class.
The currently supported options have const definitions in the class. The options, their const identifiers (with literal values in parentheses) are listed below:
Zend_Console_Getopt::CONFIG_DASHDASH("dashDash"), ifTRUE, enables the special flag -- to signify the end of flags. Command-line arguments following the double-dash signifier are not interpreted as options, even if the arguments start with a dash. This configuration option isTRUEby default.Zend_Console_Getopt::CONFIG_IGNORECASE("ignoreCase"), ifTRUE, makes flags aliases of each other if they differ only in their case. That is, -a and -A will be considered to be synonymous flags. This configuration option isFALSEby default.Zend_Console_Getopt::CONFIG_RULEMODE("ruleMode") may have valuesZend_Console_Getopt::MODE_ZEND("zend") andZend_Console_Getopt::MODE_GNU("gnu"). It should not be necessary to use this option unless you extend the class with additional syntax forms. The two modes supported in the baseZend_Console_Getoptclass are unambiguous. If the specifier is a string, the class assumesMODE_GNU, otherwise it assumesMODE_ZEND. But if you extend the class and add more syntax forms, you may need to specify the mode using this option.
More configuration options may be added as future enhancements of this class.
The two arguments to the setOption() method are
a configuration option name and an option value.
Example 132. Using setOption()
<?php
$opts = new Zend_Console_Getopt('abp:');
$opts->setOption('ignoreCase', true);
The argument to the setOptions() method is
an associative array. The keys of this array are the configuration
option names, and the values are configuration values.
This is also the array format used in the class constructor.
The configuration values you specify are merged with the current
configuration; you don't have to list all options.
Example 133. Using setOptions()
<?php
$opts = new Zend_Console_Getopt('abp:');
$opts->setOptions(
array(
'ignoreCase' => true,
'dashDash' => false
)
);




