category |
Zend |
package |
Zend_Config |
copyright |
Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license |
New BSD License |
inherited_from |
\Zend_Config |
Methods
Deep clone of this instance to ensure that nested Zend_Configs
are also cloned.
__clone() : void
Inherited
Loads the section $section from the config file encoded as YAML
__construct(string $yaml, mixed $section = null
, array|boolean $options = false
)
Sections are defined as properties of the main object
In order to extend another section, a section defines the "_extends"
property 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".
Options may include:
- allow_modifications: whether or not the config object is mutable
- skip_extends: whether or not to skip processing of parent configuration
- yaml_decoder: a callback to use to decode the Yaml source
inherited_from |
\Zend_Config::__construct() |
Parameters
$yaml
string
YAML file to process
$section
mixed
Section to process
$options
array
boolean
Zend_Config provides a property based interface to
an array. The data are read-only unless $allowModifications
is set to true on construction.
__construct(array $array, boolean $allowModifications = false
) : void
Inherited
Zend_Config also implements Countable and Iterator to
facilitate easy access to the data.
Parameters
$array
array
$allowModifications
boolean
Magic function so that $obj->value will work.
__get(string $name) : mixed
Inherited
Parameters
$name
string
Returns
mixed
Support isset() overloading on PHP 5.1
__isset(string $name) : boolean
Inherited
Parameters
$name
string
Returns
boolean
Only allow setting of a property if $allowModifications
was set to true on construction. Otherwise, throw an exception.
__set(string $name, mixed $value) : void
Inherited
Parameters
$name
string
$value
mixed
Exceptions
Support unset() overloading on PHP 5.1
__unset(string $name) : void
Inherited
Parameters
$name
string
Exceptions
Handle any errors from simplexml_load_file or parse_ini_file
_loadFileErrorHandler(integer $errno, string $errstr, string $errfile, integer $errline)
Inherited
Parameters
$errno
integer
$errstr
string
$errfile
string
$errline
integer
Returns true if all sections were loaded
areAllSectionsLoaded() : boolean
Inherited
Defined by Countable interface
count() : integer
Inherited
Defined by Iterator interface
current() : mixed
Inherited
Very dumb YAML parser
decode(string $yaml) : array
Static
Until we have Zend_Yaml...
Parameters
Returns
array
Decoded data
Retrieve a value and return $default if there is no element set.
get(string $name, mixed $default = null
) : mixed
Inherited
Parameters
$name
string
$default
mixed
Returns
mixed
Get the current extends
getExtends() : array
Inherited
Returns the section name(s) loaded.
getSectionName() : mixed
Inherited
Get callback for decoding YAML
getYamlDecoder() : callable
Whether parser should ignore constants or not
ignoreConstants() : boolean
Static
Defined by Iterator interface
key() : mixed
Inherited
Merge another Zend_Config with this one. The items
in $merge will override the same named items in
the current config.
merge(\Zend_Config $merge) : \Zend_Config
Inherited
Parameters
$merge
\Zend_Config
Returns
\Zend_Config
Defined by Iterator interface
next()
Inherited
Returns if this Zend_Config object is read only or not.
readOnly() : boolean
Inherited
Defined by Iterator interface
rewind()
Inherited
Set an extend for Zend_Config_Writer
setExtend(string $extendingSection, string $extendedSection = null
) : void
Inherited
Parameters
$extendingSection
string
$extendedSection
string
Indicate whether parser should ignore constants or not
setIgnoreConstants(boolean $flag) : void
Static
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.
setReadOnly()
Inherited
Set callback for decoding YAML
setYamlDecoder(callable $yamlDecoder) : \Zend_Config_Yaml
Parameters
$yamlDecoder
callable
the decoder to set
Returns
\Zend_Config_Yaml
Return an associative array of the stored data.
toArray() : array
Inherited
Defined by Iterator interface
valid() : boolean
Inherited
Merge two arrays recursively, overwriting keys of the same name
in $firstArray with the value in $secondArray.
_arrayMergeRecursive(mixed $firstArray, mixed $secondArray) : array
Inherited
Parameters
$firstArray
mixed
First array
$secondArray
mixed
Second array to merge into first array
Returns
array
Throws an exception if $extendingSection may not extend $extendedSection,
and tracks the section extension if it is valid.
_assertValidExtend(string $extendingSection, string $extendedSection) : void
Inherited
Parameters
$extendingSection
string
$extendedSection
string
Exceptions
Service function to decode YAML
_decodeYaml(integer $currentIndent, array $lines) : array | string
Static
Parameters
$currentIndent
integer
Current indent level
Returns
array
string
Get (reverse) sorted list of defined constant names
_getConstants() : array
Static
Parse values
_parseValue(string $value) : string
Static
Parameters
$value
string
Returns
string
Helper function to process each element in the section and handle
the "_extends" inheritance attribute.
_processExtends(array $data, string $section, array $config = array()
) : array
Parameters
$data
array
Data array to process
$section
string
Section to process
$config
array
Configuration which was parsed yet
Exceptions
\Zend_Config_Exception |
When $section cannot be found |
Returns
array
Replace any constants referenced in a string with their values
_replaceConstants(string $value) : string
Static
Parameters
$value
string
Returns
string
Properties
Whether in-memory modifications to configuration data are allowed
$_allowModifications : boolean
Number of elements in configuration data
$_count : integer
Contains array of configuration data
$_data : array
This is used to track section inheritance. The keys are names of sections that
extend other sections, and the values are the extended sections.
$_extends : array
Whether or not to ignore constants in parsed YAML
$_ignoreConstants : boolean
Static
Iteration index
$_index : integer
Load file error string.
$_loadFileErrorStr : string
Is null if there was no error while file loading
Contains which config file sections were loaded. 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.
$_loadedSection : mixed
Whether to skip extends or not
$_skipExtends : boolean
Used when unsetting values during iteration to ensure we do not skip
the next element
$_skipNextIteration : boolean
What to call when we need to decode some YAML?
$_yamlDecoder : callable
Default
array(__CLASS__, 'decode')
Constants
Attribute name that indicates what section a config extends from
EXTENDS_NAME = "_extends"