| Total Complexity | 4 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class Config |
||
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var ConfigManager|null |
||
| 18 | */ |
||
| 19 | private static $configManager; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $configPath |
||
| 23 | * |
||
| 24 | * @param string|null $defaultValue |
||
| 25 | * |
||
| 26 | * @return mixed |
||
| 27 | */ |
||
| 28 | 55 | public static function get($configPath, $defaultValue = null) |
|
| 29 | { |
||
| 30 | 55 | return self::getConfigManager() |
|
| 31 | 55 | ->getValue( |
|
| 32 | 55 | \strtolower($configPath), |
|
| 33 | $defaultValue |
||
| 34 | 55 | ); |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return ConfigManager |
||
| 39 | */ |
||
| 40 | 56 | private static function getConfigManager() |
|
| 41 | { |
||
| 42 | 56 | if (!self::$configManager instanceof ConfigManager) { |
|
| 43 | 2 | self::$configManager = new ConfigManager(__DIR__ . DIRECTORY_SEPARATOR . 'Data.php'); |
|
|
|
|||
| 44 | 2 | } |
|
| 45 | |||
| 46 | 56 | return self::$configManager; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string $configPath |
||
| 51 | * @param mixed $newValue |
||
| 52 | * |
||
| 53 | * @return ConfigManager |
||
| 54 | * @throws Exception |
||
| 55 | */ |
||
| 56 | 1 | public static function set($configPath, $newValue) |
|
| 61 | } |
||
| 62 | } |
||
| 63 |