Added get() and set() methods to Kohana_Config for consistency

This commit is contained in:
Woody Gilk 2009-04-06 18:29:15 -05:00
parent b91f0e06da
commit 1b8b7adcec

View file

@ -93,6 +93,30 @@ class Kohana_Config_Core extends ArrayObject {
return $this->getArrayCopy();
}
/**
* Get a variable from the configuration or return the default value.
*
* @param string array key
* @param mixed default value
* @return mixed
*/
public function get($key, $default = NULL)
{
return $this->offsetExists($key) ? $this->offsetGet($key) : $default;
}
/**
* Sets a value in the configuration array.
*
* @param string array key
* @param mixed array value
* @return mixed
*/
public function set($key, $value)
{
return $this->offsetSet($key, $value);
}
/**
* Overloads ArrayObject::offsetSet() to set the "changed" status when
* modifying a configuration value.