Config/Yaml.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Config  
Version
$Id$  

\Zend_Config_Yaml

Package: Zend_Config
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

>VConstant  EXTENDS_NAME = "_extends"
Attribute name that indicates what section a config extends from

Properties

>VPropertyprotectedbool $_ignoreConstants = false
static
Whether or not to ignore constants in parsed YAML
Default valuefalseDetails
Type
bool
>VPropertyprotectedboolean $_skipExtends = false
Whether to skip extends or not
Default valuefalseDetails
Type
boolean
>VPropertyprotectedcallable $_yamlDecoder = array(__CLASS__, 'decode')
What to call when we need to decode some YAML?
Default valuearray(__CLASS__, 'decode')Details
Type
callable

Methods

methodpublic__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
Parameters
NameTypeDescription
$yamlstring

YAML file to process

$sectionmixed

Section to process

$optionsarray | boolean
methodprotected_decodeYaml(int $currentIndent, array $lines) : array | string
static

Service function to decode YAML

Parameters
NameTypeDescription
$currentIndentint

Current indent level

$linesarray

YAML lines

Returns
TypeDescription
array | string
methodprotected_getConstants() : array
static

Get (reverse) sorted list of defined constant names

Returns
TypeDescription
array
methodprotected_parseValue(string $value) : string
static

Parse values

Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
string
methodprotected_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
NameTypeDescription
$dataarray

Data array to process

$sectionstring

Section to process

$configarray

Configuration which was parsed yet

Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Config_ExceptionWhen $section cannot be found
methodprotected_replaceConstants(string $value) : string
static

Replace any constants referenced in a string with their values

Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
string
methodpublicdecode(string $yaml) : array
static

Very dumb YAML parser

Until we have Zend_Yaml...
Parameters
NameTypeDescription
$yamlstring

YAML source

Returns
TypeDescription
arrayDecoded data
methodpublicgetYamlDecoder() : callable

Get callback for decoding YAML

Returns
TypeDescription
callable
methodpublicignoreConstants() : bool
static

Whether parser should ignore constants or not

Returns
TypeDescription
bool
methodpublicsetIgnoreConstants(bool $flag) : void
static

Indicate whether parser should ignore constants or not

Parameters
NameTypeDescription
$flagbool
methodpublicsetYamlDecoder(callable $yamlDecoder) : \Zend_Config_Yaml

Set callback for decoding YAML

Parameters
NameTypeDescription
$yamlDecodercallable

the decoder to set

Returns
TypeDescription
\Zend_Config_Yaml
Documentation was generated by phpDocumentor 2.2.0 .