Modules

Kohana_Config_Group
extends ArrayObject

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

package
Kohana
category
Configuration
author
Kohana Team
copyright
© 2012-2014 Kohana Team
license
https://kohana.top/license

Class declared in SYSPATH/classes/Kohana/Config/Group.php on line 17.

Constants

STD_PROP_LIST

integer 1

ARRAY_AS_PROPS

integer 2

Properties

protected string $_group_name

The group this config is for Used when updating config items

Default value:
string(0) ""

protected Kohana_Config $_parent_instance

Reference the config object that created this group Used when updating config

Default value:
NULL

Methods

public __construct( Kohana_Config $instance , string $group [, array $config = array(0) ] ) (defined in Kohana_Config_Group)

Constructs the group object. Kohana_Config passes the config group and its config items to the object here.

Parameters

  • Kohana_Config $instance required - "Owning" instance of Kohana_Config
  • string $group required - The group name
  • array $config = array(0) - Group's config

Source Code

public function __construct(Kohana_Config $instance, $group, array $config = [])
{
    $this->_parent_instance = $instance;
    $this->_group_name = $group;

    parent::__construct($config, ArrayObject::ARRAY_AS_PROPS);
}

public __toString( ) (defined in Kohana_Config_Group)

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

Alias for getArrayCopy()

Return Values

  • array - Array copy of the group's config

Source Code

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

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

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 group_name( ) (defined in Kohana_Config_Group)

Returns the config group's name

Return Values

  • string - The group name

Source Code

public function group_name()
{
    return $this->_group_name;
}

public offsetSet( string $key , mixed $value ) (defined in Kohana_Config_Group)

Overrides ArrayObject::offsetSet() This method is called when config is changed via

$config->var = 'asd';

// OR

$config['var'] = 'asd';

Parameters

  • string $key required - The key of the config item we're changing
  • mixed $value required - The new array value

Source Code

public function offsetSet($key, $value)
{
    $this->_parent_instance->_write_config($this->_group_name, $key, $value);

    return parent::offsetSet($key, $value);
}

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

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