1 | <?php |
||
18 | final class GenericOptions { |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | private $options; |
||
24 | |||
25 | /** |
||
26 | * @since 0.2 |
||
27 | * |
||
28 | * @throws InvalidArgumentException |
||
29 | */ |
||
30 | 11 | public function __construct( array $options = array() ) { |
|
39 | |||
40 | /** |
||
41 | * Sets the value of the specified option. |
||
42 | * |
||
43 | * @since 0.2 |
||
44 | * |
||
45 | * @param string $option |
||
46 | * @param mixed $value |
||
47 | * |
||
48 | * @throws InvalidArgumentException |
||
49 | */ |
||
50 | 6 | public function setOption( $option, $value ) { |
|
57 | |||
58 | /** |
||
59 | * Returns the value of the specified option. If the option is not set, |
||
60 | * an InvalidArgumentException is thrown. |
||
61 | * |
||
62 | * @since 0.2 |
||
63 | * |
||
64 | * @param string $option |
||
65 | * |
||
66 | * @throws OutOfBoundsException |
||
67 | */ |
||
68 | 11 | public function getOption( $option ) { |
|
75 | |||
76 | /** |
||
77 | * Returns if the specified option is set or not. |
||
78 | * |
||
79 | * @since 0.2 |
||
80 | * |
||
81 | * @param string $option |
||
82 | * |
||
83 | * @return boolean |
||
84 | */ |
||
85 | 4 | public function hasOption( $option ) { |
|
88 | |||
89 | /** |
||
90 | * Sets the value of an option to the provided default in case the option is not set yet. |
||
91 | * |
||
92 | * @since 0.2 |
||
93 | * |
||
94 | * @param string $option |
||
95 | * @param mixed $default |
||
96 | */ |
||
97 | 1 | public function defaultOption( $option, $default ) { |
|
102 | |||
103 | /** |
||
104 | * Requires an option to be set. |
||
105 | * If it's not set, a RuntimeException is thrown. |
||
106 | * |
||
107 | * @since 0.2 |
||
108 | * |
||
109 | * @param string $option |
||
110 | * |
||
111 | * @throws RuntimeException |
||
112 | */ |
||
113 | 1 | public function requireOption( $option ) { |
|
118 | |||
119 | /** |
||
120 | * Returns the array of all options. |
||
121 | * |
||
122 | * @since 0.2 |
||
123 | * |
||
124 | * @return array |
||
125 | */ |
||
126 | 1 | public function getOptions() { |
|
129 | |||
130 | } |
||
131 |