1234567891011121314151617181920212223 |
- <?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];
- }
- public static function has(string $name){
- return isset(self::$settings[$name]);
- }
- private static $settings = [];
- }
- ?>
|