/** * Load a config file, and optionally force a file reload * * @param String $config_file the name of the config to load (excl ".yaml") * @param Boolean $reload whether to reload a file that's already loaded * @return Array the config data as an assoc array */ public static function load($config_file = 'app', $reload = FALSE) { // Return a matching loaded config (unless reloading) if ($reload) { self::$configs[$config_file] = NULL; } if ($config = array_key(self::$configs, $config_file)) { return $config; } // Load a config file by looking in "app" and "yawf" $file = '/configs/' . $config_file . '.yaml'; if (file_exists(Symbol::APP . $file)) { self::$configs[$config_file] = YAML::parse_file(Symbol::APP . $file); } elseif (file_exists(Symbol::YAWF . $file)) { self::$configs[$config_file] = YAML::parse_file(Symbol::YAWF . $file); } else { throw new Exception("Config file \"{$config_file}.yaml\" not found"); } // Return the loaded config file as a PHP data array return self::$configs[$config_file]; }