模块

Config_Group
继承自 BootPHP_Config_Group
继承自 ArrayObject

实现: IteratorAggregate | Traversable | ArrayAccess | Serializable | Countable

The group wrapper acts as an interface to all the config directives gathered from across the system.

This is the object returned from BootPHP_Config::load

Any modifications to configuration items should be done through an instance of this object

package
BootPHP
category
配置
author
Tinsh
copyright
© 2005-2016 Kilofox Studio

该类在 SYSPATH/classes/config/group.php 第 130 行声明。

常量

STD_PROP_LIST

integer 1

ARRAY_AS_PROPS

integer 2

属性

protected string $_group_name

The group this config is for Used when updating config items

protected BootPHP_Config $_parent_instance

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

方法

public __construct( BootPHP_Config $instance , string $group [, array $config = array(0) ] ) (在 BootPHP_Config_Group 中定义)

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

参数

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

源代码

public function __construct(BootPHP_Config $instance, $group, array $config = array())
{
	$this->_parent_instance = $instance;
	$this->_group_name = $group;
	parent::__construct($config, ArrayObject::ARRAY_AS_PROPS);
}

public __toString( ) (在 BootPHP_Config_Group 中定义)

Return the current group in serialized form.

echo $config;

返回值

  • string

源代码

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

public as_array( ) (在 BootPHP_Config_Group 中定义)

Alias for getArrayCopy()

返回值

  • array - Array copy of the group's config

源代码

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

public get( string $key [, mixed $default = NULL ] ) (在 BootPHP_Config_Group 中定义)

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

返回值

  • mixed

源代码

public function get($key, $default = NULL)
{
	return $this->offsetExists($key) ? $this->offsetGet($key) : $default;
}

public group_name( ) (在 BootPHP_Config_Group 中定义)

Returns the config group's name

返回值

  • string - The group name

源代码

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

public offsetSet( string $key , mixed $value ) (在 BootPHP_Config_Group 中定义)

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 changing
  • mixed $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);
}

public set( string $key , mixed $value ) (在 BootPHP_Config_Group 中定义)

Sets a value in the configuration array.

$config->set($key, $new_value);

参数

  • string $key required - Array key
  • mixed $value required - Array value

返回值

  • $this

源代码

public function set($key, $value)
{
	$this->offsetSet($key, $value);
	return $this;
}

public append( ) (在 ArrayObject 中定义)

public asort( ) (在 ArrayObject 中定义)

public count( ) (在 ArrayObject 中定义)

public exchangeArray( ) (在 ArrayObject 中定义)

public getArrayCopy( ) (在 ArrayObject 中定义)

public getFlags( ) (在 ArrayObject 中定义)

public getIterator( ) (在 ArrayObject 中定义)

public getIteratorClass( ) (在 ArrayObject 中定义)

public ksort( ) (在 ArrayObject 中定义)

public natcasesort( ) (在 ArrayObject 中定义)

public natsort( ) (在 ArrayObject 中定义)

public offsetExists( ) (在 ArrayObject 中定义)

public offsetGet( ) (在 ArrayObject 中定义)

public offsetUnset( ) (在 ArrayObject 中定义)

public serialize( ) (在 ArrayObject 中定义)

public setFlags( ) (在 ArrayObject 中定义)

public setIteratorClass( ) (在 ArrayObject 中定义)

public uasort( ) (在 ArrayObject 中定义)

public uksort( ) (在 ArrayObject 中定义)

public unserialize( ) (在 ArrayObject 中定义)