Config/Yaml.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 [email protected] 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: Yaml.php 25169 2012-12-22 12:23:11Z rob $
\Zend_Config_Yaml
YAML Adapter for 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
Constants
Properties

boolean $_allowModifications = Whether in-memory modifications to configuration data are allowed
Inherited from: \Zend_Config::$$_allowModifications- Type
- boolean
- Inherited_from
- \Zend_Config::$$_allowModifications

array $_extends = array()
The keys are names of sections that extend other sections, and the values are the extended sections.
array()Details- Type
- array
- Inherited_from
- \Zend_Config::$$_extends

bool $_ignoreConstants = falseWhether or not to ignore constants in parsed YAML
falseDetails- Type
- bool

string $_loadFileErrorStr = null
Is null if there was no error while file loading
nullDetails- Type
- string
- Inherited_from
- \Zend_Config::$$_loadFileErrorStr

mixed $_loadedSection = Contains which config file sections were loaded.
Inherited from: \Zend_Config::$$_loadedSectionThis 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.
- Type
- mixed
- Inherited_from
- \Zend_Config::$$_loadedSection

boolean $_skipNextIteration = Used when unsetting values during iteration to ensure we do not skip the next element
Inherited from: \Zend_Config::$$_skipNextIteration- Type
- boolean
- Inherited_from
- \Zend_Config::$$_skipNextIteration
Methods

__clone() : voidDeep clone of this instance to ensure that nested Zend_Configs are also cloned.
Inherited from: \Zend_Config::__clone()
__construct(string $yaml, mixed $section = null, array | boolean $options = false) : voidLoads the section $section from the config file encoded as YAML
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
| Name | Type | Description |
|---|---|---|
| $yaml | string | YAML file to process |
| $section | mixed | Section to process |
| $options | array | boolean |

__get(string $name) : mixed
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| mixed |

__isset(string $name) : boolean
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

__set(string $name, mixed $value) : voidOnly allow setting of a property if $allowModifications was set to true on construction.
Inherited from: \Zend_Config::__set()Otherwise, throw an exception.
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $value | mixed |
| Exception | Description |
|---|---|
| \Zend_Config_Exception |

__unset(string $name) : void
| Name | Type | Description |
|---|---|---|
| $name | string |
| Exception | Description |
|---|---|
| \Zend_Config_Exception |

_arrayMergeRecursive(mixed $firstArray, mixed $secondArray) : arrayMerge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.
Inherited from: \Zend_Config::_arrayMergeRecursive()| Name | Type | Description |
|---|---|---|
| $firstArray | mixed | First array |
| $secondArray | mixed | Second array to merge into first array |
| Type | Description |
|---|---|
| array |

_assertValidExtend(string $extendingSection, string $extendedSection) : voidThrows an exception if $extendingSection may not extend $extendedSection, and tracks the section extension if it is valid.
Inherited from: \Zend_Config::_assertValidExtend()| Name | Type | Description |
|---|---|---|
| $extendingSection | string | |
| $extendedSection | string |
| Exception | Description |
|---|---|
| \Zend_Config_Exception |

_decodeYaml(int $currentIndent, array $lines) : array | stringService function to decode YAML
| Name | Type | Description |
|---|---|---|
| $currentIndent | int | Current indent level |
| $lines | array | YAML lines |
| Type | Description |
|---|---|
| array | string |

_getConstants() : arrayGet (reverse) sorted list of defined constant names
| Type | Description |
|---|---|
| array |

_loadFileErrorHandler(integer $errno, string $errstr, string $errfile, integer $errline) : voidHandle any errors from simplexml_load_file or parse_ini_file
Inherited from: \Zend_Config::_loadFileErrorHandler()| Name | Type | Description |
|---|---|---|
| $errno | integer | |
| $errstr | string | |
| $errfile | string | |
| $errline | integer |

_parseValue(string $value) : stringParse values
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| string |

_processExtends(array $data, string $section, array $config = array()) : arrayHelper function to process each element in the section and handle the "_extends" inheritance attribute.
| Name | Type | Description |
|---|---|---|
| $data | array | Data array to process |
| $section | string | Section to process |
| $config | array | Configuration which was parsed yet |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Config_Exception | When $section cannot be found |

_replaceConstants(string $value) : stringReplace any constants referenced in a string with their values
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| string |

areAllSectionsLoaded() : booleanReturns true if all sections were loaded
Inherited from: \Zend_Config::areAllSectionsLoaded()| Type | Description |
|---|---|
| boolean |

decode(string $yaml) : arrayVery dumb YAML parser
Until we have Zend_Yaml...
| Name | Type | Description |
|---|---|---|
| $yaml | string | YAML source |
| Type | Description |
|---|---|
| array | Decoded data |

get(string $name, mixed $default = null) : mixedRetrieve a value and return $default if there is no element set.
Inherited from: \Zend_Config::get()| Name | Type | Description |
|---|---|---|
| $name | string | |
| $default | mixed |
| Type | Description |
|---|---|
| mixed |

ignoreConstants() : boolWhether parser should ignore constants or not
| Type | Description |
|---|---|
| bool |

merge(\Zend_Config $merge) : \Zend_Config
The items in $merge will override the same named items in the current config.
| Name | Type | Description |
|---|---|---|
| $merge | \Zend_Config |
| Type | Description |
|---|---|
| \Zend_Config |

readOnly() : booleanReturns if this Zend_Config object is read only or not.
Inherited from: \Zend_Config::readOnly()| Type | Description |
|---|---|
| boolean |

setExtend(string $extendingSection, string $extendedSection = null) : void
| Name | Type | Description |
|---|---|---|
| $extendingSection | string | |
| $extendedSection | string |

setIgnoreConstants(bool $flag) : voidIndicate whether parser should ignore constants or not
| Name | Type | Description |
|---|---|---|
| $flag | bool |

setReadOnly() : voidPrevent 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.

setYamlDecoder(\callable $yamlDecoder) : \Zend_Config_YamlSet callback for decoding YAML
| Name | Type | Description |
|---|---|---|
| $yamlDecoder | \callable | the decoder to set |
| Type | Description |
|---|---|
| \Zend_Config_Yaml |