Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Options { |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private $options = []; |
||
19 | |||
20 | /** |
||
21 | * @since 1.0 |
||
22 | */ |
||
23 | 17 | public function __construct( array $options = [] ) { |
|
24 | 17 | $this->options = $options; |
|
25 | 17 | } |
|
26 | |||
27 | /** |
||
28 | * @since 1.0 |
||
29 | * |
||
30 | * @param string $key |
||
31 | * @param mixed $value |
||
32 | */ |
||
33 | 15 | public function set( $key, $value ) { |
|
34 | 15 | $this->options[$key] = $value; |
|
35 | 15 | } |
|
36 | |||
37 | /** |
||
38 | * @since 1.0 |
||
39 | * |
||
40 | * @param string $key |
||
41 | * |
||
42 | * @return boolean |
||
43 | */ |
||
44 | 16 | public function has( $key ) { |
|
45 | 16 | return isset( $this->options[$key] ) || array_key_exists( $key, $this->options ); |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @since 1.0 |
||
50 | * |
||
51 | * @param string $key |
||
52 | * |
||
53 | * @return string |
||
54 | * @throws InvalidArgumentException |
||
55 | */ |
||
56 | 16 | public function get( $key ) { |
|
63 | } |
||
64 | |||
65 | } |
||
66 |