Implements: Countable | Serializable | ArrayAccess | Traversable | IteratorAggregate
This class is a transparent base class for Config_Group and should not be accessed directly.
The group wrapper acts as an interface to all the config directives gathered from across the system.
This is the object returned from Kohana_Config::load
Any modifications to configuration items should be done through an instance of this object
Class declared in SYSPATH/classes/Kohana/Config/Group.php on line 17.
integer 1
integer 2
string
$_group_namelink to thisThe group this config is for Used when updating config items
string(0) ""
Kohana_Config
$_parent_instancelink to thisReference the config object that created this group Used when updating config
NULL
Constructs the group object. Kohana_Config passes the config group and its config items to the object here.
Kohana_Config
$instance
required - "Owning" instance of Kohana_Configstring
$group
required - The group namearray
$config
= array(0) - Group's config
public
function
__construct(Kohana_Config
$instance
,
$group
,
array
$config
=
array
())
{
$this
->_parent_instance =
$instance
;
$this
->_group_name =
$group
;
parent::__construct(
$config
, ArrayObject::ARRAY_AS_PROPS);
}
Return the current group in serialized form.
echo
$config
;
string
public
function
__toString()
{
return
serialize(
$this
->getArrayCopy());
}
Alias for getArrayCopy()
array
- Array copy of the group's config
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
;
}
Returns the config group's name
string
- The group name
public
function
group_name()
{
return
$this
->_group_name;
}
Overrides ArrayObject::offsetSet() This method is called when config is changed via
$config
->
var
=
'asd'
;
// OR
$config
[
'var'
] =
'asd'
;
string
$key
required - The key of the config item we're changingmixed
$value
required - The new array value
public
function
offsetSet(
$key
,
$value
)
{
$this
->_parent_instance->_write_config(
$this
->_group_name,
$key
,
$value
);
return
parent::offsetSet(
$key
,
$value
);
}
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
;
}