public static function getInstance($file) { if (is_null(self::$_instance)) { self::$_instance = new Config($file); } return self::$_instance; }
/** * get value out of the configuration */ public static function get($key, $default = null) { self::$default = $default; $segments = explode('.', $key); $data = self::load(array_shift($segments)); foreach ($segments as $segment) { if (isset($data[$segment])) { $data = $data[$segment]; } else { $data = self::$default; break; } } return $data; }
private static function initDefaultParams() { /** * App root */ if (is_null(self::$appPath)) { self::$appPath = __DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR; } /** * Controllers path */ if (is_null(self::$controllersPath)) { self::$controllersPath = self::$appPath . "Controllers" . DIRECTORY_SEPARATOR; } /** * Views path */ if (is_null(self::$viewsPath)) { self::$viewsPath = self::$appPath . "Views" . DIRECTORY_SEPARATOR; } }