refactoring config class.

This commit is contained in:
Taylor Otwell 2011-08-06 20:42:53 -05:00
parent 16a1f89929
commit 68e3b468cf
1 changed files with 1 additions and 7 deletions

View File

@ -64,7 +64,7 @@ public static function set($key, $value)
if (is_null($key) or ! static::load($module, $file))
{
throw new \Exception("Unable to find configuration file item [$key].");
throw new \Exception("Error setting configuration option. Option [$key] is not defined.");
}
static::$items[$module][$file][$key] = $value;
@ -85,8 +85,6 @@ private static function parse($key)
// the configuration key, otherwise, we will use "application" as the module.
$module = (strpos($key, '::') !== false) ? substr($key, 0, strpos($key, ':')) : 'application';
// If the configuration item is stored in a module, we need to strip the module qualifier
// off of the configuration key before continuing.
if ($module != 'application')
{
$key = substr($key, strpos($key, ':') + 2);
@ -94,8 +92,6 @@ private static function parse($key)
$segments = explode('.', $key);
// If there is more than one segment, we need to splice together and portion of the
// configuration key that comes after the first segment, which is the file name.
$key = (count($segments) > 1) ? implode('.', array_slice($segments, 1)) : null;
return array($module, $segments[0], $key);
@ -113,8 +109,6 @@ private static function parse($key)
*/
public static function load($module, $file)
{
// If the configuration items for this module and file have already been
// loaded, we can bail out of this method.
if (isset(static::$items[$module]) and array_key_exists($file, static::$items[$module])) return true;
$path = ($module === 'application') ? CONFIG_PATH : MODULE_PATH.$module.'/config/';