Zend Framework
1.12
|
Public Member Functions | |
__construct ($filename, $section=null, $options=false) | |
Loads the section $section from the config file $filename for access facilitated by nested object properties. | |
![]() | |
__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 | |
_parseIniFile ($filename) | |
Load the INI file from disk using parse_ini_file(). | |
_loadIniFile ($filename) | |
Load the ini file and preprocess the section separator (':' in the section name (that is used for section extension) so that the resultant array has the correct section names and the extension information is stored in a sub-key called ';extends'. | |
_processSection ($iniArray, $section, $config=array()) | |
Process each element in the section and handle the ";extends" inheritance key. | |
_processKey ($config, $key, $value) | |
Assign the key's value to the property list. | |
![]() | |
_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 | |
$_nestSeparator = '.' | |
$_sectionSeparator = ':' | |
$_skipExtends = false | |
![]() | |
$_allowModifications | |
$_index | |
$_count | |
$_data | |
$_skipNextIteration | |
$_loadedSection | |
$_extends = array() | |
$_loadFileErrorStr = null | |
__construct | ( | $filename, | |
$section = null , |
|||
$options = false |
|||
) |
Loads the section $section from the config file $filename for access facilitated by nested object properties.
If the section name contains a ":" then the section name to the right is loaded and included into the properties. Note that the keys in this $section will override any keys of the same name in the sections that have been included via ":".
If the $section is null, then all sections in the ini file are loaded.
If any key includes a ".", then this will act as a separator to create a sub-property.
example ini file: [all] db.connection = database hostname = live
[staging : all] hostname = staging
after calling $data = new Zend_Config_Ini($file, 'staging'); then $data->hostname === "staging" $data->db->connection === "database"
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 three configuration directives that may be set. For example:
$options = array( 'allowModifications' => false, 'nestSeparator' => ':', 'skipExtends' => false, );
string | $filename | |
mixed | $section | |
boolean | array | $options |
Zend_Config_Exception |
|
protected |
Load the ini file and preprocess the section separator (':' in the section name (that is used for section extension) so that the resultant array has the correct section names and the extension information is stored in a sub-key called ';extends'.
We use ';extends' as this can never be a valid key name in an INI file that has been loaded using parse_ini_file().
string | $filename |
Zend_Config_Exception |
|
protected |
Load the INI file from disk using parse_ini_file().
Use a private error handler to convert any loading errors into a Zend_Config_Exception
string | $filename |
Zend_Config_Exception |
|
protected |
Assign the key's value to the property list.
Handles the nest separator for sub-properties.
array | $config | |
string | $key | |
string | $value |
Zend_Config_Exception |
|
protected |
Process each element in the section and handle the ";extends" inheritance key.
Passes control to _processKey() to handle the nest separator sub-property syntax that may be used within the key name.
array | $iniArray | |
string | $section | |
array | $config |
Zend_Config_Exception |
|
protected |
|
protected |
|
protected |