AppConfig.php in WPIDE – File Manager & Code Editor 3.4, at App/AppConfig.php
| 1 | <?php |
| 2 | namespace WPIDE\App; |
| 3 | |
| 4 | use WPIDE\App\Config\Config; |
| 5 | use const WPIDE\Constants\DIR; |
| 6 | |
| 7 | class AppConfig { |
| 8 | |
| 9 | protected static $config; |
| 10 | |
| 11 | public static function load(): Config |
| 12 | { |
| 13 | if(!empty(self::$config )) { |
| 14 | return self::$config; |
| 15 | } |
| 16 | |
| 17 | self::$config = new Config(require DIR.'_configuration.php'); |
| 18 | |
| 19 | return self::$config; |
| 20 | } |
| 21 | |
| 22 | public static function get($key, $default = null) |
| 23 | { |
| 24 | self::load(); |
| 25 | |
| 26 | return self::$config->get($key, $default); |
| 27 | } |
| 28 | } |