Provides a property based interface to an array.

The data are read-only unless $allowModifications is set to true on construction.

Implements Countable, Iterator and ArrayAccess to facilitate easy access to the data.

 Methods

Deep clone of this instance to ensure that nested Zend\Configs are also cloned.

__clone() : void

Constructor.

__construct(array $array, bool $allowModifications) 

Data is read-only unless $allowModifications is set to true on construction.

Parameters

$array

array

$allowModifications

bool

Magic function so that $obj->value will work.

__get(string $name) : mixed

Parameters

$name

string

Returns

mixed

isset() overloading

__isset(string $name) : bool

Parameters

$name

string

Returns

bool

Set a value in the config.

__set(string $name, mixed $value) : void

Only allow setting of a property if $allowModifications was set to true on construction. Otherwise, throw an exception.

Parameters

$name

string

$value

mixed

Exceptions

\Zend\Config\Exception\RuntimeException

unset() overloading

__unset(string $name) : void

Parameters

$name

string

Exceptions

\Zend\Config\Exception\InvalidArgumentException

count(): defined by Countable interface.

count() : int

see \Countable::count()

Returns

int

current(): defined by Iterator interface.

current() : mixed

see \Iterator::current()

Returns

mixed

Retrieve a value and return $default if there is no element set.

get(string $name, mixed $default) : mixed

Parameters

$name

string

$default

mixed

Returns

mixed

Returns whether this Config object is read only or not.

isReadOnly() : bool

Returns

bool

key(): defined by Iterator interface.

key() : mixed

see \Iterator::key()

Returns

mixed

Merge another Config with this one.

merge(\Zend\Config\Config $merge) : \Zend\Config\Config

For duplicate keys, the following will be performed: - Nested Configs will be recursively merged. - Items in $merge with INTEGER keys will be appended. - Items in $merge with STRING keys will overwrite current values.

Parameters

Returns

offsetExists(): defined by ArrayAccess interface.

offsetExists(mixed $offset) : bool

see \ArrayAccess::offsetExists()

Parameters

$offset

mixed

Returns

bool

offsetGet(): defined by ArrayAccess interface.

offsetGet(mixed $offset) : mixed

see \ArrayAccess::offsetGet()

Parameters

$offset

mixed

Returns

mixed

offsetSet(): defined by ArrayAccess interface.

offsetSet(mixed $offset, mixed $value) : void

see \ArrayAccess::offsetSet()

Parameters

$offset

mixed

$value

mixed

offsetUnset(): defined by ArrayAccess interface.

offsetUnset(mixed $offset) : void

see \ArrayAccess::offsetUnset()

Parameters

$offset

mixed

rewind(): defined by Iterator interface.

rewind() : void

see \Iterator::rewind()

Prevent any more modifications being made to this instance.

setReadOnly() : void

Useful after merge() has been used to merge multiple Config objects into one object which should then not be modified again.

Return an associative array of the stored data.

toArray() : array

Returns

array

valid(): defined by Iterator interface.

valid() : bool

see \Iterator::valid()

Returns

bool

 Properties

 

Whether modifications to configuration data are allowed.

$allowModifications : bool

 

Number of elements in configuration data.

$count : int

 

Data within the configuration.

$data : array

 

Used when unsetting values during iteration to ensure we do not skip the next element.

$skipNextIteration : bool