Config/Ini.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Config  
Version
$Id: Ini.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Config_Ini

Package: Zend\Config
Parent(s)
\Zend_Config
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedboolean $_allowModifications
inherited
Whether in-memory modifications to configuration data are allowed
Inherited from: \Zend_Config::$$_allowModifications
Details
Type
boolean
Inherited_from
\Zend_Config::$$_allowModifications  
>VPropertyprotectedinteger $_count
inherited
Number of elements in configuration data
Inherited from: \Zend_Config::$$_count
Details
Type
integer
Inherited_from
\Zend_Config::$$_count  
>VPropertyprotectedarray $_data
inherited
Contains array of configuration data
Inherited from: \Zend_Config::$$_data
Details
Type
array
Inherited_from
\Zend_Config::$$_data  
>VPropertyprotectedarray $_extends = array()
inherited
This is used to track section inheritance.
Inherited from: \Zend_Config::$$_extends

The keys are names of sections that extend other sections, and the values are the extended sections.

Default valuearray()Details
Type
array
Inherited_from
\Zend_Config::$$_extends  
>VPropertyprotectedinteger $_index
inherited
Iteration index
Inherited from: \Zend_Config::$$_index
Details
Type
integer
Inherited_from
\Zend_Config::$$_index  
>VPropertyprotectedstring $_loadFileErrorStr = null
inherited
Load file error string.
Inherited from: \Zend_Config::$$_loadFileErrorStr

Is null if there was no error while file loading

Default valuenullDetails
Type
string
Inherited_from
\Zend_Config::$$_loadFileErrorStr  
>VPropertyprotectedmixed $_loadedSection
inherited
Contains which config file sections were loaded.
Inherited from: \Zend_Config::$$_loadedSection

This is null if all sections were loaded, a string name if one section is loaded and an array of string names if multiple sections were loaded.

Details
Type
mixed
Inherited_from
\Zend_Config::$$_loadedSection  
>VPropertyprotectedstring $_nestSeparator = '.'
String that separates nesting levels of configuration data identifiers
Default value'.'Details
Type
string
>VPropertyprotectedstring $_sectionSeparator = ':'
String that separates the parent section name
Default value':'Details
Type
string
>VPropertyprotectedboolean $_skipExtends = false
Whether to skip extends or not
Default valuefalseDetails
Type
boolean
>VPropertyprotectedboolean $_skipNextIteration
inherited
Used when unsetting values during iteration to ensure we do not skip the next element
Inherited from: \Zend_Config::$$_skipNextIteration
Details
Type
boolean
Inherited_from
\Zend_Config::$$_skipNextIteration  

Methods

methodpublic__clone() : void
inherited

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

Inherited from: \Zend_Config::__clone()
methodpublic__construct(string $filename, mixed $section = null, boolean | array $options = false) : void

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, );

Parameters
NameTypeDescription
$filenamestring
$sectionmixed
$optionsboolean | array
Throws
ExceptionDescription
\Zend_Config_Exception
methodpublic__get(string $name) : mixed
inherited

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

Inherited from: \Zend_Config::__get()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
mixed
methodpublic__isset(string $name) : boolean
inherited

Support isset() overloading on PHP 5.1

Inherited from: \Zend_Config::__isset()
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
boolean
methodpublic__set(string $name, mixed $value) : void
inherited

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

Inherited from: \Zend_Config::__set()

Otherwise, throw an exception.

Parameters
NameTypeDescription
$namestring
$valuemixed
Throws
ExceptionDescription
\Zend_Config_Exception
methodpublic__unset(string $name) : void
inherited

Support unset() overloading on PHP 5.1

Inherited from: \Zend_Config::__unset()
Parameters
NameTypeDescription
$namestring
Throws
ExceptionDescription
\Zend_Config_Exception
methodprotected_arrayMergeRecursive(mixed $firstArray, mixed $secondArray) : array
inherited

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

Inherited from: \Zend_Config::_arrayMergeRecursive()
Parameters
NameTypeDescription
$firstArraymixed

First array

$secondArraymixed

Second array to merge into first array

Returns
TypeDescription
array
methodprotected_assertValidExtend(string $extendingSection, string $extendedSection) : void
inherited

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

Inherited from: \Zend_Config::_assertValidExtend()
Parameters
NameTypeDescription
$extendingSectionstring
$extendedSectionstring
Throws
ExceptionDescription
\Zend_Config_Exception
methodprotected_loadFileErrorHandler(integer $errno, string $errstr, string $errfile, integer $errline) : void
inherited

Handle any errors from simplexml_load_file or parse_ini_file

Inherited from: \Zend_Config::_loadFileErrorHandler()
Parameters
NameTypeDescription
$errnointeger
$errstrstring
$errfilestring
$errlineinteger
methodprotected_loadIniFile(string $filename) : array

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().

Parameters
NameTypeDescription
$filenamestring
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Config_Exception
methodprotected_parseIniFile(string $filename) : array

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

Parameters
NameTypeDescription
$filenamestring
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Config_Exception
methodprotected_processKey(array $config, string $key, string $value) : array

Assign the key's value to the property list.

Handles the nest separator for sub-properties.

Parameters
NameTypeDescription
$configarray
$keystring
$valuestring
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Config_Exception
methodprotected_processSection(array $iniArray, string $section, array $config = array()) : array

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.

Parameters
NameTypeDescription
$iniArrayarray
$sectionstring
$configarray
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Config_Exception
methodpublicareAllSectionsLoaded() : boolean
inherited

Returns true if all sections were loaded

Inherited from: \Zend_Config::areAllSectionsLoaded()
Returns
TypeDescription
boolean
methodpubliccount() : int
inherited

Defined by Countable interface

Inherited from: \Zend_Config::count()
Returns
TypeDescription
int
methodpubliccurrent() : mixed
inherited

Defined by Iterator interface

Inherited from: \Zend_Config::current()
Returns
TypeDescription
mixed
methodpublicget(string $name, mixed $default = null) : mixed
inherited

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

Inherited from: \Zend_Config::get()
Parameters
NameTypeDescription
$namestring
$defaultmixed
Returns
TypeDescription
mixed
methodpublicgetExtends() : array
inherited

Get the current extends

Inherited from: \Zend_Config::getExtends()
Returns
TypeDescription
array
methodpublicgetSectionName() : mixed
inherited

Returns the section name(s) loaded.

Inherited from: \Zend_Config::getSectionName()
Returns
TypeDescription
mixed
methodpublickey() : mixed
inherited

Defined by Iterator interface

Inherited from: \Zend_Config::key()
Returns
TypeDescription
mixed
methodpublicmerge(\Zend_Config $merge) : \Zend_Config
inherited

Merge another Zend_Config with this one.

Inherited from: \Zend_Config::merge()

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

Parameters
NameTypeDescription
$merge\Zend_Config
Returns
TypeDescription
\Zend_Config
methodpublicnext() : void
inherited

Defined by Iterator interface

Inherited from: \Zend_Config::next()
methodpublicreadOnly() : boolean
inherited

Returns if this Zend_Config object is read only or not.

Inherited from: \Zend_Config::readOnly()
Returns
TypeDescription
boolean
methodpublicrewind() : void
inherited

Defined by Iterator interface

Inherited from: \Zend_Config::rewind()
methodpublicsetExtend(string $extendingSection, string $extendedSection = null) : void
inherited

Set an extend for Zend_Config_Writer

Inherited from: \Zend_Config::setExtend()
Parameters
NameTypeDescription
$extendingSectionstring
$extendedSectionstring
methodpublicsetReadOnly() : void
inherited

Prevent any more modifications being made to this instance.

Inherited from: \Zend_Config::setReadOnly()

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

methodpublictoArray() : array
inherited

Return an associative array of the stored data.

Inherited from: \Zend_Config::toArray()
Returns
TypeDescription
array
methodpublicvalid() : boolean
inherited

Defined by Iterator interface

Inherited from: \Zend_Config::valid()
Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.0.0a12.