public function getUsageMessage()
    {
        $usage = "Usage: {$this->_progname} [ options ]\n";
        $maxLen = 20;
        $lines = array();
        foreach ($this->_rules as $rule) {
            $flags = array();
            if (is_array($rule['alias'])) {
                foreach ($rule['alias'] as $flag) {
                    $flags[] = (strlen($flag) == 1 ? '-' : '--') . $flag;
                }
            }
            $linepart['name'] = implode('|', $flags);
            if (isset($rule['param']) && $rule['param'] != 'none') {
                $linepart['name'] .= ' ';
                switch ($rule['param']) {
                    case 'optional':
                        $linepart['name'] .= "[ <{$rule['paramType']}> ]";
                        break;
                    case 'required':
                        $linepart['name'] .= "<{$rule['paramType']}>";
                        break;
                }
            }
            if (strlen($linepart['name']) > $maxLen) {
                $maxLen = strlen($linepart['name']);
            }
            $linepart['help'] = '';
            if (isset($rule['help'])) {
                $linepart['help'] .= $rule['help'];
            }
            $lines[] = $linepart;
        }
        foreach ($lines as $linepart) {
            $usage .= sprintf("%s %s\n",
            str_pad($linepart['name'], $maxLen),
            $linepart['help']);
        }
        return $usage;
    }
public function getUsageMessage()
    {
        $usage = "Usage: {$this->_progname} [ options ]\n";
        $maxLen = 20;
        $lines = array();
        foreach ($this->_rules as $rule) {
            $flags = array();
            if (is_array($rule['alias'])) {
                foreach ($rule['alias'] as $flag) {
                    $flags[] = (strlen($flag) == 1 ? '-' : '--') . $flag;
                }
            }
            $linepart['name'] = implode('|', $flags);
            if (isset($rule['param']) && $rule['param'] != 'none') {
                $linepart['name'] .= ' ';
                switch ($rule['param']) {
                    case 'optional':
                        $linepart['name'] .= "[ <{$rule['paramType']}> ]";
                        break;
                    case 'required':
                        $linepart['name'] .= "<{$rule['paramType']}>";
                        break;
                }
            }
            if (strlen($linepart['name']) > $maxLen) {
                $maxLen = strlen($linepart['name']);
            }
            $linepart['help'] = '';
            if (isset($rule['help'])) {
                $linepart['help'] .= $rule['help'];
            }
            $lines[] = $linepart;
        }
        foreach ($lines as $linepart) {
            $usage .= sprintf("%s %s\n",
            str_pad($linepart['name'], $maxLen),
            $linepart['help']);
        }
        return $usage;
    }
public function getUsageMessage ( ) { $ usage = "Usage: {$this->_progname} [ options ]\n" ; $ maxLen = 20 ; $ lines = array ( ) ; foreach ( $ this -> _rules as $ rule ) { $ flags = array ( ) ; if ( is_array ( $ rule [ 'alias' ] ) ) { foreach ( $ rule [ 'alias' ] as $ flag ) { $ flags [ ] = ( strlen ( $ flag ) == 1 ? '-' : '--' ) . $ flag ; } } $ linepart [ 'name' ] = implode ( '|' , $ flags ) ; if ( isset ( $ rule [ 'param' ] ) && $ rule [ 'param' ] != 'none' ) { $ linepart [ 'name' ] .= ' ' ; switch ( $ rule [ 'param' ] ) { case 'optional' : $ linepart [ 'name' ] .= "[ <{$rule['paramType']}> ]" ; break ; case 'required' : $ linepart [ 'name' ] .= "<{$rule['paramType']}>" ; break ; } } if ( strlen ( $ linepart [ 'name' ] ) > $ maxLen ) { $ maxLen = strlen ( $ linepart [ 'name' ] ) ; } $ linepart [ 'help' ] = '' ; if ( isset ( $ rule [ 'help' ] ) ) { $ linepart [ 'help' ] .= $ rule [ 'help' ] ; } $ lines [ ] = $ linepart ; } foreach ( $ lines as $ linepart ) { $ usage .= sprintf ( "%s %s\n" , str_pad ( $ linepart [ 'name' ] , $ maxLen ) , $ linepart [ 'help' ] ) ; } return $ usage ; }
Return a useful option reference, formatted for display in an
error message.

Note that this usage information is provided in most Exceptions
generated by this class.

@return string
Return a useful option reference formatted for display in an error message .