Modules

Config_File
extends Kohana_Config_File
extends Kohana_Config_File_Reader

Implements: Kohana_Config_Reader | Kohana_Config_Source

File-based configuration reader. Multiple configuration directories can be used by attaching multiple instances of this class to Config.

package
Kohana
category
Configuration
author
Kohana Team
copyright
© 2009-2012 Kohana Team
license
https://kohana.top/license

Class declared in SYSPATH/classes/Config/File.php on line 3.

Constants

  • None

Properties

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;
}