API Documentation

Config/Ini.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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Config  
version
$Id: Ini.php 24045 2011-05-23 12:45:11Z rob $  

\Zend_Config_Ini

Extends from
\Zend_Config
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Config  

Properties

Propertyprotectedstring  $_nestSeparator= '.'

String that separates nesting levels of configuration data identifiers

Default value.Details
Type
string
Propertyprotectedstring  $_sectionSeparator= ':'

String that separates the parent section name

Default value:Details
Type
string
Propertyprotectedboolean  $_skipExtends= 'false'

Whether to skip extends or not

Default valuefalseDetails
Type
boolean

Methods

methodpublic__clone( ) : void

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
Name Type Description
$filename string
$section mixed
$options boolean|array
Throws
Exception Description
\Zend_Config_Exception
methodpublic__get( string $name ) : mixed

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

Inherited from: \Zend_Config::__get()
Parameters
Name Type Description
$name string
Returns
Type Description
mixed
methodpublic__isset( string $name ) : boolean

Support isset() overloading on PHP 5.1

Inherited from: \Zend_Config::__isset()
Parameters
Name Type Description
$name string
Returns
Type Description
boolean
methodpublic__set( string $name, mixed $value ) : void

Only allow setting of a property if $allowModifications was set to true on construction. Otherwise, throw an exception.

Inherited from: \Zend_Config::__set()
Parameters
Name Type Description
$name string
$value mixed
Throws
Exception Description
\Zend_Config_Exception
methodpublic__unset( string $name ) : void

Support unset() overloading on PHP 5.1

Inherited from: \Zend_Config::__unset()
Parameters
Name Type Description
$name string
Throws
Exception Description
\Zend_Config_Exception
methodprotected_arrayMergeRecursive( mixed $firstArray, mixed $secondArray ) : array

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

Inherited from: \Zend_Config::_arrayMergeRecursive()
Parameters
Name Type Description
$firstArray mixed First array
$secondArray mixed Second array to merge into first array
Returns
Type Description
array
methodprotected_assertValidExtend( string $extendingSection, string $extendedSection ) : void

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

Inherited from: \Zend_Config::_assertValidExtend()
Parameters
Name Type Description
$extendingSection string
$extendedSection string
Throws
Exception Description
\Zend_Config_Exception
methodprotected_loadFileErrorHandler( integer $errno, string $errstr, string $errfile, integer $errline ) : void

Handle any errors from simplexml_load_file or parse_ini_file

Inherited from: \Zend_Config::_loadFileErrorHandler()
Parameters
Name Type Description
$errno integer
$errstr string
$errfile string
$errline integer
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
Name Type Description
$filename string
Returns
Type Description
array
Throws
Exception Description
\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
Name Type Description
$filename string
Returns
Type Description
array
Throws
Exception Description
\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
Name Type Description
$config array
$key string
$value string
Returns
Type Description
array
Throws
Exception Description
\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
Name Type Description
$iniArray array
$section string
$config array
Returns
Type Description
array
Throws
Exception Description
\Zend_Config_Exception
methodpublicareAllSectionsLoaded( ) : boolean

Returns true if all sections were loaded

Inherited from: \Zend_Config::areAllSectionsLoaded()
Returns
Type Description
boolean
methodpubliccount( ) : int

Defined by Countable interface

Inherited from: \Zend_Config::count()
Returns
Type Description
int
methodpubliccurrent( ) : mixed

Defined by Iterator interface

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

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

Inherited from: \Zend_Config::get()
Parameters
Name Type Description
$name string
$default mixed
Returns
Type Description
mixed
methodpublicgetExtends( ) : array

Get the current extends

Inherited from: \Zend_Config::getExtends()
Returns
Type Description
array
methodpublicgetSectionName( ) : mixed

Returns the section name(s) loaded.

Inherited from: \Zend_Config::getSectionName()
Returns
Type Description
mixed
methodpublickey( ) : mixed

Defined by Iterator interface

Inherited from: \Zend_Config::key()
Returns
Type Description
mixed
methodpublicmerge( \Zend_Config $merge ) : \Zend_Config

Merge another Zend_Config with this one. The items in $merge will override the same named items in the current config.

Inherited from: \Zend_Config::merge()
Parameters
Name Type Description
$merge \Zend_Config
Returns
Type Description
\Zend_Config
methodpublicnext( ) : void

Defined by Iterator interface

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

Returns if this Zend_Config object is read only or not.

Inherited from: \Zend_Config::readOnly()
Returns
Type Description
boolean
methodpublicrewind( ) : void

Defined by Iterator interface

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

Set an extend for Zend_Config_Writer

Inherited from: \Zend_Config::setExtend()
Parameters
Name Type Description
$extendingSection string
$extendedSection string
methodpublicsetReadOnly( ) : void

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.

Inherited from: \Zend_Config::setReadOnly()
methodpublictoArray( ) : array

Return an associative array of the stored data.

Inherited from: \Zend_Config::toArray()
Returns
Type Description
array
methodpublicvalid( ) : boolean

Defined by Iterator interface

Inherited from: \Zend_Config::valid()
Returns
Type Description
boolean
Documentation was generated by DocBlox 0.13.3.