Commit fc871032 authored by Taylor Otwell's avatar Taylor Otwell

Refactoring configuration class.

parent f4fac15e
...@@ -45,9 +45,7 @@ class Config { ...@@ -45,9 +45,7 @@ class Config {
list($file, $key) = static::parse($key); list($file, $key) = static::parse($key);
static::load($file); if ( ! static::load($file))
if ( ! array_key_exists($file, static::$items))
{ {
return is_callable($default) ? call_user_func($default) : $default; return is_callable($default) ? call_user_func($default) : $default;
} }
...@@ -99,11 +97,11 @@ class Config { ...@@ -99,11 +97,11 @@ class Config {
* Any environment specific configuration files will be merged with the root file. * Any environment specific configuration files will be merged with the root file.
* *
* @param string $file * @param string $file
* @return void * @return bool
*/ */
public static function load($file) public static function load($file)
{ {
if (array_key_exists($file, static::$items)) return; if (array_key_exists($file, static::$items)) return true;
$config = (file_exists($path = CONFIG_PATH.$file.EXT)) ? require $path : array(); $config = (file_exists($path = CONFIG_PATH.$file.EXT)) ? require $path : array();
...@@ -112,10 +110,7 @@ class Config { ...@@ -112,10 +110,7 @@ class Config {
$config = array_merge($config, require $path); $config = array_merge($config, require $path);
} }
if (count($config) > 0) return (count(static::$items[$file] = $config) > 0);
{
static::$items[$file] = $config;
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment