protected function _addRulesModeZend($rules)
    {
        foreach ($rules as $ruleCode => $helpMessage) {
            // this may have to translate the long parm type if there
            // are any complaints that =string will not work (even though that use
            // case is not documented)
            if (in_array(substr($ruleCode, -2, 1), array('-', '='))) {
                $flagList  = substr($ruleCode, 0, -2);
                $delimiter = substr($ruleCode, -2, 1);
                $paramType = substr($ruleCode, -1);
            } else {
                $flagList = $ruleCode;
                $delimiter = $paramType = null;
            }
            if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) {
                $flagList = strtolower($flagList);
            }
            $flags = explode('|', $flagList);
            $rule = array();
            $mainFlag = $flags[0];
            foreach ($flags as $flag) {
                if (empty($flag)) {
                    require_once 'Zend/Console/Getopt/Exception.php';
                    throw new Zend_Console_Getopt_Exception(
                        "Blank flag not allowed in rule \"$ruleCode\".");
                }
                if (strlen($flag) == 1) {
                    if (isset($this->_ruleMap[$flag])) {
                        require_once 'Zend/Console/Getopt/Exception.php';
                        throw new Zend_Console_Getopt_Exception(
                            "Option \"-$flag\" is being defined more than once.");
                    }
                    $this->_ruleMap[$flag] = $mainFlag;
                    $rule['alias'][] = $flag;
                } else {
                    if (isset($this->_rules[$flag]) || isset($this->_ruleMap[$flag])) {
                        require_once 'Zend/Console/Getopt/Exception.php';
                        throw new Zend_Console_Getopt_Exception(
                            "Option \"--$flag\" is being defined more than once.");
                    }
                    $this->_ruleMap[$flag] = $mainFlag;
                    $rule['alias'][] = $flag;
                }
            }
            if (isset($delimiter)) {
                switch ($delimiter) {
                    case self::PARAM_REQUIRED:
                        $rule['param'] = 'required';
                        break;
                    case self::PARAM_OPTIONAL:
                    default:
                        $rule['param'] = 'optional';
                }
                switch (substr($paramType, 0, 1)) {
                    case self::TYPE_WORD:
                        $rule['paramType'] = 'word';
                        break;
                    case self::TYPE_INTEGER:
                        $rule['paramType'] = 'integer';
                        break;
                    case self::TYPE_STRING:
                    default:
                        $rule['paramType'] = 'string';
                }
            } else {
                $rule['param'] = 'none';
            }
            $rule['help'] = $helpMessage;
            $this->_rules[$mainFlag] = $rule;
        }
    }
protected function _addRulesModeZend($rules)
    {
        foreach ($rules as $ruleCode => $helpMessage) {
            // this may have to translate the long parm type if there
            // are any complaints that =string will not work (even though that use
            // case is not documented)
            if (in_array(substr($ruleCode, -2, 1), array('-', '='))) {
                $flagList  = substr($ruleCode, 0, -2);
                $delimiter = substr($ruleCode, -2, 1);
                $paramType = substr($ruleCode, -1);
            } else {
                $flagList = $ruleCode;
                $delimiter = $paramType = null;
            }
            if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) {
                $flagList = strtolower($flagList);
            }
            $flags = explode('|', $flagList);
            $rule = array();
            $mainFlag = $flags[0];
            foreach ($flags as $flag) {
                if (empty($flag)) {
                    require_once 'Zend/Console/Getopt/Exception.php';
                    throw new Zend_Console_Getopt_Exception(
                        "Blank flag not allowed in rule \"$ruleCode\".");
                }
                if (strlen($flag) == 1) {
                    if (isset($this->_ruleMap[$flag])) {
                        require_once 'Zend/Console/Getopt/Exception.php';
                        throw new Zend_Console_Getopt_Exception(
                            "Option \"-$flag\" is being defined more than once.");
                    }
                    $this->_ruleMap[$flag] = $mainFlag;
                    $rule['alias'][] = $flag;
                } else {
                    if (isset($this->_rules[$flag]) || isset($this->_ruleMap[$flag])) {
                        require_once 'Zend/Console/Getopt/Exception.php';
                        throw new Zend_Console_Getopt_Exception(
                            "Option \"--$flag\" is being defined more than once.");
                    }
                    $this->_ruleMap[$flag] = $mainFlag;
                    $rule['alias'][] = $flag;
                }
            }
            if (isset($delimiter)) {
                switch ($delimiter) {
                    case self::PARAM_REQUIRED:
                        $rule['param'] = 'required';
                        break;
                    case self::PARAM_OPTIONAL:
                    default:
                        $rule['param'] = 'optional';
                }
                switch (substr($paramType, 0, 1)) {
                    case self::TYPE_WORD:
                        $rule['paramType'] = 'word';
                        break;
                    case self::TYPE_INTEGER:
                        $rule['paramType'] = 'integer';
                        break;
                    case self::TYPE_STRING:
                    default:
                        $rule['paramType'] = 'string';
                }
            } else {
                $rule['param'] = 'none';
            }
            $rule['help'] = $helpMessage;
            $this->_rules[$mainFlag] = $rule;
        }
    }
protected function _addRulesModeZend ( $ rules ) { foreach ( $ rules as $ ruleCode => $ helpMessage ) { // this may have to translate the long parm type if there // are any complaints that =string will not work (even though that use // case is not documented) if ( in_array ( substr ( $ ruleCode , - 2 , 1 ) , array ( '-' , '=' ) ) ) { $ flagList = substr ( $ ruleCode , 0 , - 2 ) ; $ delimiter = substr ( $ ruleCode , - 2 , 1 ) ; $ paramType = substr ( $ ruleCode , - 1 ) ; } else { $ flagList = $ ruleCode ; $ delimiter = $ paramType = null ; } if ( $ this -> _getoptConfig [ self :: CONFIG_IGNORECASE ] ) { $ flagList = strtolower ( $ flagList ) ; } $ flags = explode ( '|' , $ flagList ) ; $ rule = array ( ) ; $ mainFlag = $ flags [ 0 ] ; foreach ( $ flags as $ flag ) { if ( empty ( $ flag ) ) { require_once 'Zend/Console/Getopt/Exception.php' ; throw new Zend_Console_Getopt_Exception ( "Blank flag not allowed in rule \"$ruleCode\"." ) ; } if ( strlen ( $ flag ) == 1 ) { if ( isset ( $ this -> _ruleMap [ $ flag ] ) ) { require_once 'Zend/Console/Getopt/Exception.php' ; throw new Zend_Console_Getopt_Exception ( "Option \"-$flag\" is being defined more than once." ) ; } $ this -> _ruleMap [ $ flag ] = $ mainFlag ; $ rule [ 'alias' ] [ ] = $ flag ; } else { if ( isset ( $ this -> _rules [ $ flag ] ) || isset ( $ this -> _ruleMap [ $ flag ] ) ) { require_once 'Zend/Console/Getopt/Exception.php' ; throw new Zend_Console_Getopt_Exception ( "Option \"--$flag\" is being defined more than once." ) ; } $ this -> _ruleMap [ $ flag ] = $ mainFlag ; $ rule [ 'alias' ] [ ] = $ flag ; } } if ( isset ( $ delimiter ) ) { switch ( $ delimiter ) { case self :: PARAM_REQUIRED : $ rule [ 'param' ] = 'required' ; break ; case self :: PARAM_OPTIONAL : default : $ rule [ 'param' ] = 'optional' ; } switch ( substr ( $ paramType , 0 , 1 ) ) { case self :: TYPE_WORD : $ rule [ 'paramType' ] = 'word' ; break ; case self :: TYPE_INTEGER : $ rule [ 'paramType' ] = 'integer' ; break ; case self :: TYPE_STRING : default : $ rule [ 'paramType' ] = 'string' ; } } else { $ rule [ 'param' ] = 'none' ; } $ rule [ 'help' ] = $ helpMessage ; $ this -> _rules [ $ mainFlag ] = $ rule ; } }
Define legal options using the Zend-style format.

@param  array $rules
@throws Zend_Console_Getopt_Exception
@return void
Define legal options using the Zend - style format .