1 | <?php |
||
9 | class DefaultsWithDescriptions |
||
10 | { |
||
11 | /** |
||
12 | * @var array Associative array of key : default mappings |
||
13 | */ |
||
14 | protected $values; |
||
15 | |||
16 | /** |
||
17 | * @var array Associative array of key : description mappings |
||
18 | */ |
||
19 | protected $descriptions; |
||
20 | |||
21 | /** |
||
22 | * @var mixed Default value that the default value of items in |
||
23 | * the collection should take when not specified in the 'add' method. |
||
24 | */ |
||
25 | protected $defaultDefault; |
||
26 | |||
27 | public function __construct($values, $defaultDefault = null) |
||
33 | |||
34 | /** |
||
35 | * Return just the key : default values mapping |
||
36 | * |
||
37 | * @return array |
||
38 | */ |
||
39 | public function getValues() |
||
43 | |||
44 | /** |
||
45 | * Check to see whether the speicifed key exists in the collection. |
||
46 | * |
||
47 | * @param string $key |
||
48 | * @return boolean |
||
49 | */ |
||
50 | public function exists($key) |
||
54 | |||
55 | /** |
||
56 | * Get the value of one entry. |
||
57 | * |
||
58 | * @param string $key The key of the item. |
||
59 | * @return string |
||
60 | */ |
||
61 | public function get($key) |
||
68 | |||
69 | /** |
||
70 | * Get the description of one entry. |
||
71 | * |
||
72 | * @param string $key The key of the item. |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getDescription($key) |
||
82 | |||
83 | /** |
||
84 | * Add another argument to this command. |
||
85 | * |
||
86 | * @param string $key Name of the argument. |
||
87 | * @param string $description Help text for the argument. |
||
88 | * @param mixed $defaultValue The default value for the argument. |
||
89 | */ |
||
90 | public function add($key, $description, $defaultValue = null) |
||
100 | |||
101 | /** |
||
102 | * Change the default value of an entry. |
||
103 | * |
||
104 | * @param string $key |
||
105 | * @param mixed $defaultValue |
||
106 | */ |
||
107 | public function setDefaultValue($key, $defaultValue) |
||
111 | |||
112 | /** |
||
113 | * Remove an entry |
||
114 | * |
||
115 | * @param string $key The entry to remove |
||
116 | */ |
||
117 | public function clear($key) |
||
122 | |||
123 | /** |
||
124 | * Rename an existing option to something else. |
||
125 | */ |
||
126 | public function rename($oldName, $newName) |
||
131 | } |
||
132 |