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-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Config
- Version
- $Id$
\Zend_Config_Yaml
Package: Zend_Config
Returns
YAML Adapter for Zend_Config
- Parent(s)
- \Zend_Config
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
bool $_ignoreConstants = false
static
Whether or not to ignore constants in parsed YAML
Default value
false
Details- Type
- bool
Methods
__construct(string $yaml, mixed $section = null, array | boolean $options = false) : void
Loads 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
ParametersName | Type | Description |
---|---|---|
$yaml | string | YAML file to process |
$section | mixed | Section to process |
$options | array | boolean |
_decodeYaml(int $currentIndent, array $lines) : array | string
static
Service function to decode YAML
Parameters
Returns
Name | Type | Description |
---|---|---|
$currentIndent | int | Current indent level |
$lines | array | YAML lines |
Type | Description |
---|---|
array | string |
_getConstants() : array
static
Get (reverse) sorted list of defined constant names
Returns
Type | Description |
---|---|
array |
_parseValue(string $value) : string
static
Parse values
Parameters
Returns
Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
string |
_processExtends(array $data, string $section, array $config = array()) : array
Helper function to process each element in the section and handle the "_extends" inheritance attribute.
Parameters
Returns
Throws
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) : string
static
Replace any constants referenced in a string with their values
Parameters
Returns
Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
string |
decode(string $yaml) : array
static
Very dumb YAML parser
Until we have Zend_Yaml...
ParametersName | Type | Description |
---|---|---|
$yaml | string | YAML source |
Type | Description |
---|---|
array | Decoded data |
ignoreConstants() : bool
static
Whether parser should ignore constants or not
Returns
Type | Description |
---|---|
bool |
setIgnoreConstants(bool $flag) : void
static
Indicate whether parser should ignore constants or not
Parameters
Name | Type | Description |
---|---|---|
$flag | bool |
setYamlDecoder(callable $yamlDecoder) : \Zend_Config_Yaml
Set callback for decoding YAML
Parameters
Returns
Name | Type | Description |
---|---|---|
$yamlDecoder | callable | the decoder to set |
Type | Description |
---|---|
\Zend_Config_Yaml |