Class Config_File

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
(c) Kohana Team
license
https://koseven.ga/LICENSE.md


Information

This class is a transparent base class for Kohana_Config_File

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

Do you want to contribute to Koseven?

We need YOUR help!

This project is open source. What does this mean? YOU can help:
  • Found a bug? Report it on Github
  • Need a feature? Add it Here
  • Want to help? Join the Forum
Go to Github