| 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 | 45 | public function add(string $key, string|bool|int|float|null $value): void |
|
| 18 | { |
||
| 19 | 45 | $this->collection[$key] = $value; |
|
| 20 | } |
||
| 21 | |||
| 22 | 21 | public function get(string $key, float|bool|int|string|null $default = null): float|bool|int|string|null |
|
| 23 | { |
||
| 24 | 21 | return $this->has($key) ? $this->collection[$key] : $default; |
|
| 25 | } |
||
| 26 | |||
| 27 | 22 | public function has(string $key): bool |
|
| 28 | { |
||
| 29 | 22 | 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 | 42 | public function getKeys(): array |
|
| 43 | } |
||
| 44 | |||
| 45 | |||
| 46 | 5 | public function getCollection(): array |
|
| 47 | { |
||
| 53 |