Exemple #1
0
 /**
  * Merge all of the configuration files in this group.
  *
  * @param   string  group name
  * @param   array   configuration array
  * @return  $this   clone of the current object
  */
 public function load($group, array $config = NULL)
 {
     if (($files = Ko::findFile($this->_directory, $group)) !== FALSE) {
         $config = array();
         foreach ($files as $file) {
             $config = Arr::merge($config, require $file);
         }
     }
     return parent::load($group, $config);
 }
Exemple #2
0
 /**
  * Overload setting offsets to insert or update the database values as
  * changes occur.
  *
  * @param   string   array key
  * @param   mixed    new value
  * @return  mixed
  */
 public function offsetSet($key, $value)
 {
     if (!$this->offsetExists($key)) {
         // Insert a new value
         DB::insert($this->_database_table, array('group_name', 'config_key', 'config_value'))->values(array($this->_configuration_group, $key, serialize($value)))->execute($this->_database_instance);
     } elseif ($this->offsetGet($key) !== $value) {
         // Update the value
         DB::update($this->_database_table)->value('config_value', serialize($value))->where('group_name', '=', $this->_configuration_group)->where('config_key', '=', $key)->execute($this->_database_instance);
     }
     return parent::offsetSet($key, $value);
 }
Exemple #3
0
 /**
  * Load and merge all of the configuration files in this group.
  *
  *     $config->load($name);
  *
  * @param   string  configuration group name
  * @param   array   configuration array
  * @return  $this   clone of the current object
  * @uses    Kohana::load
  */
 public function load($group, array $config = NULL)
 {
     if ($files = Kohana::find_file($this->_directory, $group, NULL, TRUE)) {
         // Initialize the config array
         $config = array();
         foreach ($files as $file) {
             // Merge each file to the configuration array
             $config = Arr::merge($config, Kohana::load($file));
         }
     }
     return parent::load($group, $config);
 }
Exemple #4
0
 /**
  * Merges configurations from all the loaded files.
  * @param string $group
  * @param array $config
  * @return Config_Reader
  */
 public function load($group, array $config = NULL)
 {
     if ($files = Exido::findFile($this->_directory, $group)) {
         // Set config array
         $config = array();
         foreach ($files as $file) {
             // Merge each config array to the global array
             $config = arrayMerge($config, require $file);
         }
     }
     return parent::load($group, $config);
 }