extends Kohana_Config_Reader
extends ArrayObject

Implements: IteratorAggregate | Traversable | ArrayAccess | Serializable | Countable

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

Kohana Team
© 2008-2012 Kohana Team

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



integer 1


integer 2


protected string $_configuration_group

Configuration group name


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


  • 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.


  • 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

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


  • 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)