Config/Xml.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Config
- Version
- $Id$
\Zend_Config_Xml
Package: Zend_Config
Throws
XML Adapter for Zend_Config
- Parent(s)
- \Zend_Config
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
Methods
__construct(string $xml, mixed $section = null, array | boolean $options = false) : void
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
);
ParametersName | Type | Description |
---|---|---|
$xml | string | XML file or string to process |
$section | mixed | Section to process |
$options | array | boolean |
Exception | Description |
---|---|
\Zend_Config_Exception | When xml is not set or cannot be loaded |
\Zend_Config_Exception | When section $sectionName cannot be found in $xml |
_processExtends(\SimpleXMLElement $element, string $section, array $config = array()) : array
Helper function to process each element in the section and handle the "extends" inheritance attribute.
Parameters
Returns
Throws
Name | Type | Description |
---|---|---|
$element | \SimpleXMLElement | XML Element to process |
$section | string | Section to process |
$config | array | Configuration which was parsed yet |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Config_Exception | When $section cannot be found |
_toArray(\SimpleXMLElement $xmlObject) : array | string
Returns a string or an associative and possibly multidimensional array from a SimpleXMLElement.
Parameters
Returns
Name | Type | Description |
---|---|---|
$xmlObject | \SimpleXMLElement | Convert a SimpleXMLElement into an array |
Type | Description |
---|---|
array | string |