Zend Framework  1.12
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_Config Class Reference

Public Member Functions

 __construct (array $array, $allowModifications=false)
 Zend_Config provides a property based interface to an array.
 
 get ($name, $default=null)
 Retrieve a value and return $default if there is no element set.
 
 __get ($name)
 Magic function so that $obj->value will work.
 
 __set ($name, $value)
 Only allow setting of a property if $allowModifications was set to true on construction.
 
 __clone ()
 Deep clone of this instance to ensure that nested Zend_Configs are also cloned.
 
 toArray ()
 Return an associative array of the stored data.
 
 __isset ($name)
 Support isset() overloading on PHP 5.1.
 
 __unset ($name)
 Support unset() overloading on PHP 5.1.
 
 count ()
 Defined by Countable interface.
 
 current ()
 Defined by Iterator interface.
 
 key ()
 Defined by Iterator interface.
 
 next ()
 Defined by Iterator interface.
 
 rewind ()
 Defined by Iterator interface.
 
 valid ()
 Defined by Iterator interface.
 
 getSectionName ()
 Returns the section name(s) loaded.
 
 areAllSectionsLoaded ()
 Returns true if all sections were loaded.
 
 merge (Zend_Config $merge)
 Merge another Zend_Config with this one.
 
 setReadOnly ()
 Prevent any more modifications being made to this instance.
 
 readOnly ()
 Returns if this Zend_Config object is read only or not.
 
 getExtends ()
 Get the current extends.
 
 setExtend ($extendingSection, $extendedSection=null)
 Set an extend for Zend_Config_Writer.
 
 _loadFileErrorHandler ($errno, $errstr, $errfile, $errline)
 Handle any errors from simplexml_load_file or parse_ini_file.
 

Protected Member Functions

 _assertValidExtend ($extendingSection, $extendedSection)
 Throws an exception if $extendingSection may not extend $extendedSection, and tracks the section extension if it is valid.
 
 _arrayMergeRecursive ($firstArray, $secondArray)
 Merge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.
 

Protected Attributes

 $_allowModifications
 
 $_index
 
 $_count
 
 $_data
 
 $_skipNextIteration
 
 $_loadedSection
 
 $_extends = array()
 
 $_loadFileErrorStr = null
 

Constructor & Destructor Documentation

__construct ( array  $array,
  $allowModifications = false 
)

Zend_Config provides a property based interface to an array.

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

Zend_Config also implements Countable and Iterator to facilitate easy access to the data.

Parameters
array$array
boolean$allowModifications
Returns
void

Member Function Documentation

__clone ( )

Deep clone of this instance to ensure that nested Zend_Configs are also cloned.

Returns
void
__get (   $name)

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

Parameters
string$name
Returns
mixed
__isset (   $name)

Support isset() overloading on PHP 5.1.

Parameters
string$name
Returns
boolean
__set (   $name,
  $value 
)

Only allow setting of a property if $allowModifications was set to true on construction.

Otherwise, throw an exception.

Parameters
string$name
mixed$value
Exceptions
Zend_Config_Exception
Returns
void
See Also
Zend_Config_Exception
__unset (   $name)

Support unset() overloading on PHP 5.1.

Parameters
string$name
Exceptions
Zend_Config_Exception
Returns
void
See Also
Zend_Config_Exception
_arrayMergeRecursive (   $firstArray,
  $secondArray 
)
protected

Merge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.

Parameters
mixed$firstArrayFirst array
mixed$secondArraySecond array to merge into first array
Returns
array
_assertValidExtend (   $extendingSection,
  $extendedSection 
)
protected

Throws an exception if $extendingSection may not extend $extendedSection, and tracks the section extension if it is valid.

Parameters
string$extendingSection
string$extendedSection
Exceptions
Zend_Config_Exception
Returns
void
See Also
Zend_Config_Exception
_loadFileErrorHandler (   $errno,
  $errstr,
  $errfile,
  $errline 
)

Handle any errors from simplexml_load_file or parse_ini_file.

Parameters
integer$errno
string$errstr
string$errfile
integer$errline
areAllSectionsLoaded ( )

Returns true if all sections were loaded.

Returns
boolean
count ( )

Defined by Countable interface.

Returns
int
current ( )

Defined by Iterator interface.

Returns
mixed
get (   $name,
  $default = null 
)

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

Parameters
string$name
mixed$default
Returns
mixed
getExtends ( )

Get the current extends.

Returns
array
getSectionName ( )

Returns the section name(s) loaded.

Returns
mixed
key ( )

Defined by Iterator interface.

Returns
mixed
merge ( Zend_Config  $merge)

Merge another Zend_Config with this one.

The items in $merge will override the same named items in the current config.

Parameters
Zend_Config$merge
Returns
Zend_Config
next ( )

Defined by Iterator interface.

readOnly ( )

Returns if this Zend_Config object is read only or not.

Returns
boolean
rewind ( )

Defined by Iterator interface.

setExtend (   $extendingSection,
  $extendedSection = null 
)

Set an extend for Zend_Config_Writer.

Parameters
string$extendingSection
string$extendedSection
Returns
void
setReadOnly ( )

Prevent any more modifications being made to this instance.

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

toArray ( )

Return an associative array of the stored data.

Returns
array
valid ( )

Defined by Iterator interface.

Returns
boolean

Member Data Documentation

$_allowModifications
protected
$_count
protected
$_data
protected
$_extends = array()
protected
$_index
protected
$_loadedSection
protected
$_loadFileErrorStr = null
protected
$_skipNextIteration
protected