Total Complexity | 4 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
22 | class Options |
||
23 | { |
||
24 | /** |
||
25 | * Map of options |
||
26 | * |
||
27 | * @var array<string, string> |
||
28 | */ |
||
29 | private $options; |
||
30 | |||
31 | /** |
||
32 | * Options constructor |
||
33 | * |
||
34 | * @param array<string, string> $options |
||
35 | 68 | */ |
|
36 | public function __construct(array $options) |
||
37 | 68 | { |
|
38 | 68 | $this->options = $options; |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * Return a option value |
||
43 | * |
||
44 | * @param string $name |
||
45 | * @param mixed $default |
||
46 | * @return mixed |
||
47 | 18 | */ |
|
48 | public function get(string $name, $default = null) |
||
49 | 18 | { |
|
50 | return isset($this->options[$name]) ? $this->options[$name] : $default; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Return all options |
||
55 | * |
||
56 | * @return array |
||
57 | 14 | */ |
|
58 | public function getAll(): array |
||
61 | } |
||
62 | } |
||
63 |