Modules
abstract Kohana_Config_Reader
extends ArrayObject
Abstract configuration reader. All configuration readers must extend this class.
Class declared in SYSPATH/classes/kohana/config/reader.php on line 12.
Constants
Properties
Methods
- __construct()
- __toString()
- as_array()
- get()
- load()
- set()
- append()
- asort()
- count()
- exchangeArray()
- getArrayCopy()
- getFlags()
- getIterator()
- getIteratorClass()
- ksort()
- natcasesort()
- natsort()
- offsetExists()
- offsetGet()
- offsetSet()
- offsetUnset()
- serialize()
- setFlags()
- setIteratorClass()
- uasort()
- uksort()
- unserialize()
Constants
STD_PROP_LIST
integer 1
ARRAY_AS_PROPS
integer 2
Properties
protected
string$_configuration_groupConfiguration 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;
}