| Total Complexity | 8 |
| Total Lines | 84 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 5 | class Configuration |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Settings |
||
| 9 | * |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected static $settings = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Confirms that a given key exists in configuration settings. |
||
| 16 | * |
||
| 17 | * @param string $key |
||
| 18 | * |
||
| 19 | 8 | * @return bool |
|
| 20 | */ |
||
| 21 | 8 | public static function has($key) |
|
| 22 | { |
||
| 23 | return isset(static::$settings[$key]); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Attempts to retrieve a given key from configuration settings. Returns |
||
| 28 | * default if not set. |
||
| 29 | * |
||
| 30 | * @param string $key |
||
| 31 | * @param mixed $default |
||
| 32 | * |
||
| 33 | 708 | * @return mixed |
|
| 34 | */ |
||
| 35 | 708 | public static function get($key = null, $default = null) |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Parses give options against default options. |
||
| 46 | * |
||
| 47 | * @param array $options |
||
| 48 | * @param array $defaults |
||
| 49 | * |
||
| 50 | 712 | * @return array |
|
| 51 | */ |
||
| 52 | public static function parseDefaultOptions($options = [], $defaults = []) |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Updates configuration settings with key value pair. |
||
| 65 | * |
||
| 66 | * @param string $key |
||
| 67 | * @param mixed $value |
||
| 68 | * |
||
| 69 | 712 | * @return void |
|
| 70 | */ |
||
| 71 | 712 | public static function set($key, $value) |
|
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Updates configuration settings with collection of key value pairs. |
||
| 78 | * |
||
| 79 | * @param array $settings |
||
| 80 | * |
||
| 81 | 712 | * @return void |
|
| 82 | */ |
||
| 83 | 712 | public static function setMany($settings = [], $defaultSettings = []) |
|
| 92 |