API Documentation

Config/Ini.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Config
version
$Id: Ini.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Config_Ini

Description

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.

Zend_Config_Ini

Extends from
Zend_Config
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Config
Properties
$_nestSeparator
$_sectionSeparator
$_skipExtends
Methods
__construct
_parseIniFile
_loadIniFile
_processSection
_processKey

Description

Properties

$_nestSeparator

string $_nestSeparator = '.'

String that separates nesting levels of configuration data identifiers

Details

$_nestSeparator
string
visibility
protected
default
.
final
false
static
false

$_sectionSeparator

string $_sectionSeparator = ':'

String that separates the parent section name

Details

$_sectionSeparator
string
visibility
protected
default
:
final
false
static
false

$_skipExtends

boolean $_skipExtends = 'false'

Whether to skip extends or not

Details

$_skipExtends
boolean
visibility
protected
default
false
final
false
static
false

Methods

__construct

__construct( string $filename, string|null $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 two configuration directives that may be set. For example:

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

Arguments
$filename
string
$section
stringnull
$options
booleanarray
Details
visibility
public
final
false
static
false
throws

_loadIniFile

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

Arguments
$filename
string
Output
array
Details
visibility
protected
final
false
static
false
throws

_parseIniFile

_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

Arguments
$filename
string
Output
array
Details
visibility
protected
final
false
static
false
throws

_processKey

_processKey( array $config, string $key, string $value ) : array

Assign the key's value to the property list. Handles the nest separator for sub-properties.

Arguments
$config
array
$key
string
$value
string
Output
array
Details
visibility
protected
final
false
static
false
throws

_processSection

_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.

Arguments
$iniArray
array
$section
string
$config
array
Output
array
Details
visibility
protected
final
false
static
false
throws
Documentation was generated by DocBlox.