1234567891011121314151617181920 |
- <?php
- namespace Juju;
- class Settings {
- public static function init(array $settings){
- array_walk($settings, function($val, $name){
- self::set($name, $val);
- });
- }
- public static function set(string $name, $val){
- self::$settings[$name] = $val;
- }
- public static function get(string $name){
- if(!isset(self::$settings[$name])){
- throw new \Exception("Setting not set");
- }
- return self::$settings[$name];
- }
- private static $settings = [];
- }
- ?>
|