Added Route::$cache flag, fixes #3212. Includes tests.
[kohana-core.git] / classes / kohana / config / file.php
blob3178204c7c7e826f532cded027694744dba81c72
1 <?php defined('SYSPATH') or die('No direct script access.');
2 /**
3 * File-based configuration reader. Multiple configuration directories can be
4 * used by attaching multiple instances of this class to [Kohana_Config].
6 * @package Kohana
7 * @category Configuration
8 * @author Kohana Team
9 * @copyright (c) 2009-2010 Kohana Team
10 * @license http://kohanaframework.org/license
12 class Kohana_Config_File extends Kohana_Config_Reader {
14 // Configuration group name
15 protected $_configuration_group;
17 // Has the config group changed?
18 protected $_configuration_modified = FALSE;
20 public function __construct($directory = 'config')
22 // Set the configuration directory name
23 $this->_directory = trim($directory, '/');
25 // Load the empty array
26 parent::__construct();
29 /**
30 * Load and merge all of the configuration files in this group.
32 * $config->load($name);
34 * @param string configuration group name
35 * @param array configuration array
36 * @return $this clone of the current object
37 * @uses Kohana::load
39 public function load($group, array $config = NULL)
41 if ($files = Kohana::find_file($this->_directory, $group, NULL, TRUE))
43 // Initialize the config array
44 $config = array();
46 foreach ($files as $file)
48 // Merge each file to the configuration array
49 $config = Arr::merge($config, Kohana::load($file));
53 return parent::load($group, $config);
56 } // End Kohana_Config