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