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