Kohana_Config_File
extends Kohana_Config_File_Reader
Implements: Kohana_Config_Source | Kohana_Config_Reader
File-based configuration reader. Multiple configuration directories can be used by attaching multiple instances of this class to Config.
Properties
-
protected string $_directory
-
The directory where config files are located
-
Default value:
string(0) ""
Methods
public __construct([ string $directory = string(6) "config" ] ) (defined in Kohana_Config_File_Reader)
Creates a new file reader using the given directory as a config source
Parameters
- string $directory = string(6) "config" - Configuration directory to search
Source Code
public function __construct($directory = 'config')
{
// Set the configuration directory name
$this->_directory = trim($directory, '/');
}
public load(string $group ) (defined in Kohana_Config_File_Reader)
Load and merge all of the configuration files in this group.
$config->load($name);
Parameters
- string $group required - Configuration group name
Tags
Return Values
- $this - Current object
Source Code
public function load($group)
{
$config = [];
if ($files = Kohana::find_file($this->_directory, $group, NULL, TRUE))
{
foreach ($files as $file)
{
// Merge each file to the configuration array
$config = Arr::merge($config, Kohana::load($file));
}
}
return $config;
}