1: <?php
2: /**
3: * @author Chuck Hagenbuch <chuck@horde.org>
4: * @author Mike Naberezny <mike@maintainable.com>
5: * @license http://www.horde.org/licenses/bsd BSD
6: * @category Horde
7: * @package Argv
8: */
9:
10: /**
11: * @category Horde
12: * @package Argv
13: */
14: class Horde_Argv_OptionGroup extends Horde_Argv_OptionContainer
15: {
16: protected $_title;
17:
18: public function __construct($parser, $title, $description = null)
19: {
20: $this->parser = $parser;
21: parent::__construct($parser->optionClass, $parser->conflictHandler, $description);
22: $this->_title = $title;
23: }
24:
25: protected function _createOptionList()
26: {
27: $this->optionList = array();
28: $this->_shareOptionMappings($this->parser);
29: }
30:
31: public function setTitle($title)
32: {
33: $this->_title = $title;
34: }
35:
36: public function __destruct()
37: {
38: unset($this->optionList);
39: }
40:
41: // -- Help-formatting methods ---------------------------------------
42:
43: public function formatHelp($formatter = null)
44: {
45: if (is_null($formatter))
46: return '';
47:
48: $result = $formatter->formatHeading($this->_title);
49: $formatter->indent();
50: $result .= parent::formatHelp($formatter);
51: $formatter->dedent();
52: return $result;
53: }
54:
55: }
56: