Modules

Config_Reader
extends Kohana_Config_Reader
extends ArrayObject

Implements: IteratorAggregate | Traversable | ArrayAccess | Serializable | Countable

Abstract configuration reader. All configuration readers must extend this class.

package
Kohana
category
Configuration
author
Kohana Team
copyright
© 2008-2012 Kohana Team
license
http://kohanaframework.org/license

Class declared in SYSPATH/classes/config/reader.php on line 3.

Constants

STD_PROP_LIST

integer 1

ARRAY_AS_PROPS

integer 2

Properties

protected string $_configuration_group

Configuration group name

Methods

public __construct( ) (defined in Kohana_Config_Reader)

Loads an empty array as the initial configuration and enables array keys to be used as properties.

Return Values

  • void

Source Code

public function __construct()
{
	parent::__construct(array(), ArrayObject::ARRAY_AS_PROPS);
}

public __toString( ) (defined in Kohana_Config_Reader)

Return the current group in serialized form.

echo $config;

Return Values

  • string

Source Code

public function __toString()
{
	return serialize($this->getArrayCopy());
}

public as_array( ) (defined in Kohana_Config_Reader)

Return the raw array that is being used for this object.

$array = $config->as_array();

Return Values

  • array

Source Code

public function as_array()
{
	return $this->getArrayCopy();
}

public get( string $key [, mixed $default = NULL ] ) (defined in Kohana_Config_Reader)

Get a variable from the configuration or return the default value.

$value = $config->get($key);

Parameters

  • string $key required - Array key
  • mixed $default = NULL - Default value

Return Values

  • mixed

Source Code

public function get($key, $default = NULL)
{
	return $this->offsetExists($key) ? $this->offsetGet($key) : $default;
}

public load( string $group [, array $config = NULL ] ) (defined in Kohana_Config_Reader)

Loads a configuration group.

$config->load($name, $array);

This method must be extended by all readers. After the group has been loaded, call parent::load($group, $config) for final preparation.

Parameters

  • string $group required - Configuration group name
  • array $config = NULL - Configuration array

Return Values

  • $this - A clone of this object

Source Code

public function load($group, array $config = NULL)
{
	if ($config === NULL)
	{
		return FALSE;
	}

	// Clone the current object
	$object = clone $this;

	// Set the group name
	$object->_configuration_group = $group;

	// Swap the array with the actual configuration
	$object->exchangeArray($config);

	return $object;
}

public set( string $key , mixed $value ) (defined in Kohana_Config_Reader)

Sets a value in the configuration array.

$config->set($key, $new_value);

Parameters

  • string $key required - Array key
  • mixed $value required - Array value

Return Values

  • $this

Source Code

public function set($key, $value)
{
	$this->offsetSet($key, $value);

	return $this;
}

public append( ) (defined in ArrayObject)

public asort( ) (defined in ArrayObject)

public count( ) (defined in ArrayObject)

public exchangeArray( ) (defined in ArrayObject)

public getArrayCopy( ) (defined in ArrayObject)

public getFlags( ) (defined in ArrayObject)

public getIterator( ) (defined in ArrayObject)

public getIteratorClass( ) (defined in ArrayObject)

public ksort( ) (defined in ArrayObject)

public natcasesort( ) (defined in ArrayObject)

public natsort( ) (defined in ArrayObject)

public offsetExists( ) (defined in ArrayObject)

public offsetGet( ) (defined in ArrayObject)

public offsetSet( ) (defined in ArrayObject)

public offsetUnset( ) (defined in ArrayObject)

public serialize( ) (defined in ArrayObject)

public setFlags( ) (defined in ArrayObject)

public setIteratorClass( ) (defined in ArrayObject)

public uasort( ) (defined in ArrayObject)

public uksort( ) (defined in ArrayObject)

public unserialize( ) (defined in ArrayObject)