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.

package Default

 Methods

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

__clone() : void

Constructor.

__construct(array $array, boolean $allowModifications = false

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

Parameters

$array

array

$allowModifications

boolean

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

__get(string $name) : mixed

Parameters

$name

string

Returns

mixed

isset() overloading

__isset(string $name) : boolean

Parameters

$name

string

Returns

boolean

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() : integer
see

Returns

integer

current(): defined by Iterator interface.

current() : mixed
see

Returns

mixed

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

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

Parameters

$name

string

$default

mixed

Returns

mixed

Returns whether this Config object is read only or not.

isReadOnly() : boolean

Returns

boolean

key(): defined by Iterator interface.

key() : mixed
see

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

$merge

\Zend\Config\Config

Returns

\Zend\Config\Config

next(): defined by Iterator interface.

next() : void
see

offsetExists(): defined by ArrayAccess interface.

offsetExists(mixed $offset) : boolean
see

Parameters

$offset

mixed

Returns

boolean

offsetGet(): defined by ArrayAccess interface.

offsetGet(mixed $offset) : mixed
see

Parameters

$offset

mixed

Returns

mixed

offsetSet(): defined by ArrayAccess interface.

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

Parameters

$offset

mixed

$value

mixed

offsetUnset(): defined by ArrayAccess interface.

offsetUnset(mixed $offset) : void
see

Parameters

$offset

mixed

rewind(): defined by Iterator interface.

rewind() : void
see

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() : boolean
see

Returns

boolean

 Properties

 

Whether modifications to configuration data are allowed.

$allowModifications : boolean

Default

 

Data within the configuration.

$data : array

Default

array()
 

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

$skipNextIteration : boolean

Default