Added get() and set() methods to Kohana_Config for consistency
This commit is contained in:
parent
b91f0e06da
commit
1b8b7adcec
|
@ -93,6 +93,30 @@ class Kohana_Config_Core extends ArrayObject {
|
||||||
return $this->getArrayCopy();
|
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
|
* Overloads ArrayObject::offsetSet() to set the "changed" status when
|
||||||
* modifying a configuration value.
|
* modifying a configuration value.
|
||||||
|
|
Loading…
Reference in a new issue