_configuration_group = $group; if ($cache === FALSE) { // Load the configuration $config = Kohana_Config::load($group); } elseif (($config = Kohana::cache(self::CACHE_PREFIX.$group)) === NULL) { // Load the configuration, it has not been cached $config = Kohana_Config::load($group); // Create a cache of the configuration group Kohana::cache(self::CACHE_PREFIX.$group, $config); } // Load the array using the values as properties ArrayObject::__construct($config, ArrayObject::ARRAY_AS_PROPS); } /** * Return the "changed" status of the configuration object. * * @return boolean */ public function changed() { return $this->_configuration_modified; } /** * Return the raw array that is being used for this object. * * @return array */ public function as_array() { 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. * * @param string array key * @param mixed array value * @return mixed */ public function offsetSet($key, $value) { if ($this->offsetGet($key) !== $value) { // The value is about to be modified $this->_configuration_modified = TRUE; } return parent::offsetSet($key, $value); } } // End Kohana_Config