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

Public Member Functions

 __construct ($xml, $section=null, $options=false)
 Loads the section $section from the config file (or string $xml for access facilitated by nested object properties.
 
- Public Member Functions inherited from Zend_Config
 __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.
 

Public Attributes

const XML_NAMESPACE = 'http://framework.zend.com/xml/zend-config-xml/1.0/'
 XML namespace for ZF-related tags and attributes.
 

Protected Member Functions

 _processExtends (SimpleXMLElement $element, $section, array $config=array())
 Helper function to process each element in the section and handle the "extends" inheritance attribute.
 
 _toArray (SimpleXMLElement $xmlObject)
 Returns a string or an associative and possibly multidimensional array from a SimpleXMLElement.
 
- Protected Member Functions inherited from Zend_Config
 _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

 $_skipExtends = false
 
- Protected Attributes inherited from Zend_Config
 $_allowModifications
 
 $_index
 
 $_count
 
 $_data
 
 $_skipNextIteration
 
 $_loadedSection
 
 $_extends = array()
 
 $_loadFileErrorStr = null
 

Constructor & Destructor Documentation

__construct (   $xml,
  $section = null,
  $options = false 
)

Loads the section $section from the config file (or string $xml for access facilitated by nested object properties.

Sections are defined in the XML as children of the root element.

In order to extend another section, a section defines the "extends" attribute having a value of the section name from which the extending section inherits values.

Note that the keys in $section will override any keys of the same name in the sections that have been included via "extends".

The $options parameter may be provided as either a boolean or an array. If provided as a boolean, this sets the $allowModifications option of Zend_Config. If provided as an array, there are two configuration directives that may be set. For example:

$options = array( 'allowModifications' => false, 'skipExtends' => false );

Parameters
string$xmlXML file or string to process
mixed$sectionSection to process
array | boolean$options
Exceptions
Zend_Config_ExceptionWhen xml is not set or cannot be loaded
Zend_Config_ExceptionWhen section $sectionName cannot be found in $xml

Member Function Documentation

_processExtends ( SimpleXMLElement  $element,
  $section,
array  $config = array() 
)
protected

Helper function to process each element in the section and handle the "extends" inheritance attribute.

Parameters
SimpleXMLElement$elementXML Element to process
string$sectionSection to process
array$configConfiguration which was parsed yet
Exceptions
Zend_Config_ExceptionWhen $section cannot be found
Returns
array
_toArray ( SimpleXMLElement  $xmlObject)
protected

Returns a string or an associative and possibly multidimensional array from a SimpleXMLElement.

Parameters
SimpleXMLElement$xmlObjectConvert a SimpleXMLElement into an array
Returns
array|string

Member Data Documentation

$_skipExtends = false
protected
const XML_NAMESPACE = 'http://framework.zend.com/xml/zend-config-xml/1.0/'

XML namespace for ZF-related tags and attributes.