| 1 | <?php |
||
| 5 | /** |
||
| 6 | * Loads and reads config file. |
||
| 7 | */ |
||
| 8 | class Config |
||
| 9 | { |
||
| 10 | private static $config = []; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Load a config file, it will replace |
||
| 14 | * all the currently loaded configuration. |
||
| 15 | * |
||
| 16 | * @return void |
||
| 17 | */ |
||
| 18 | public static function load($file) |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Read a config value. |
||
| 26 | * |
||
| 27 | * @param string $name The name of the config variable |
||
| 28 | * @return mixed The value or null. |
||
| 29 | */ |
||
| 30 | public static function read($name) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get all the configuration options. |
||
| 41 | * |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | public static function all() |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Write a config value. |
||
| 51 | * |
||
| 52 | * @param string $name The name of the config variable |
||
| 53 | * @param mixed $value The value of the config variable |
||
| 54 | * @return void |
||
| 55 | */ |
||
| 56 | public static function write($name, $value) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Clear out the data stored in the config class. |
||
| 63 | * |
||
| 64 | * @return void |
||
| 65 | */ |
||
| 66 | public static function clear() |
||
| 67 | { |
||
| 68 | self::$config = []; |
||
| 71 |