Total Complexity | 7 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | final class EnvCollection |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * @var array<string, string|bool|int|float|null> |
||
14 | */ |
||
15 | private array $collection = []; |
||
16 | |||
17 | 46 | public function add(string $key, string|bool|int|float|null $value): void |
|
18 | { |
||
19 | 46 | $this->collection[$key] = $value; |
|
20 | } |
||
21 | |||
22 | 20 | public function get(string $key, float|bool|int|string|null $default = null): float|bool|int|string|null |
|
23 | { |
||
24 | 20 | return $this->has($key) ? $this->collection[$key] : $default; |
|
25 | } |
||
26 | |||
27 | 21 | public function has(string $key): bool |
|
28 | { |
||
29 | 21 | return array_key_exists($key, $this->collection); |
|
30 | } |
||
31 | |||
32 | 1 | public function delete(string $key): void |
|
33 | { |
||
34 | 1 | unset($this->collection[$key]); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return string[] |
||
39 | */ |
||
40 | 43 | public function getKeys(): array |
|
43 | } |
||
44 | |||
45 | |||
46 | 5 | public function getCollection(): array |
|
47 | { |
||
53 |