Implements: Countable | Serializable | ArrayAccess | Traversable | IteratorAggregate
Abstract configuration reader. All configuration readers must extend this class.
Class declared in SYSPATH/classes/kohana/config/reader.php on line 12.
integer 1
integer 2
string
$_configuration_groupConfiguration group name
Loads an empty array as the initial configuration and enables array keys to be used as properties.
void
public function __construct()
{
parent::__construct(array(), ArrayObject::ARRAY_AS_PROPS);
}
Return the current group in serialized form.
echo $config;
string
public function __toString()
{
return serialize($this->getArrayCopy());
}
Return the raw array that is being used for this object.
$array = $config->as_array();
array
public function as_array()
{
return $this->getArrayCopy();
}
Get a variable from the configuration or return the default value.
$value = $config->get($key);
string
$key
required - Array keymixed
$default
= NULL - Default valuemixed
public function get($key, $default = NULL)
{
return $this->offsetExists($key) ? $this->offsetGet($key) : $default;
}
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 namearray
$config
= NULL - Configuration array$this
- A clone of this objectpublic 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;
}
Sets a value in the configuration array.
$config->set($key, $new_value);
string
$key
required - Array keymixed
$value
required - Array value$this
public function set($key, $value)
{
$this->offsetSet($key, $value);
return $this;
}