Total Complexity | 4 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | final class ArraySettings implements SettingsInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | private $settings; |
||
15 | |||
16 | public function __construct(array $settings) |
||
17 | { |
||
18 | $this->settings = array_change_key_case($settings, CASE_UPPER); |
||
19 | } |
||
20 | |||
21 | public function getSetting(string $name) |
||
22 | { |
||
23 | if (!$this->hasSetting($name)) { |
||
24 | throw new UnknownSettingException("Unknown setting '$name'"); |
||
25 | } |
||
26 | |||
27 | return $this->settings[strtoupper($name)]; |
||
28 | } |
||
29 | |||
30 | public function hasSetting(string $name): bool |
||
33 | } |
||
34 | } |
||
35 |