API Documentation

Zend/Config/Yaml.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Config  
Version
$Id: Yaml.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Config_Yaml

Package: Zend\Config

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

Constant  EXTENDS_NAME = "_extends"

Attribute name that indicates what section a config extends from

Properties

Propertyprotectedbool  $_ignoreConstants= 'false'
static

Whether or not to ignore constants in parsed YAML

Default valuefalseDetails
Type
bool
Propertyprotectedboolean  $_skipExtends= 'false'

Whether to skip extends or not

Default valuefalseDetails
Type
boolean
Propertyprotected\callable  $_yamlDecoder= 'array(__CLASS__'

What to call when we need to decode some YAML?

Default valuearray(__CLASS__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
Name Type Description
$yaml string

YAML file to process

$section mixed

Section to process

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

Service function to decode YAML

Parameters
Name Type Description
$currentIndent int

Current indent level

$lines array

YAML lines

Returns
Type Description
array|string
methodprotected_getConstants( ) : array
static

Get (reverse) sorted list of defined constant names

Returns
Type Description
array
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
Name Type Description
$data array

Data array to process

$section string

Section to process

$config array

Configuration which was parsed yet

Returns
Type Description
array
Throws
Exception Description
\Zend_Config_Exception When $section cannot be found
methodprotected_replaceConstants( string $value ) : string
static

Replace any constants referenced in a string with their values

Parameters
Name Type Description
$value string
Returns
Type Description
string
methodpublicdecode( string $yaml ) : array
static

Very dumb YAML parser

Until we have Zend_Yaml...

Parameters
Name Type Description
$yaml string

YAML source

Returns
Type Description
array Decoded data
methodpublicgetYamlDecoder( ) : \callable

Get callback for decoding YAML

Returns
Type Description
\callable
methodpublicignoreConstants( ) : bool
static

Whether parser should ignore constants or not

Returns
Type Description
bool
methodpublicsetIgnoreConstants( bool $flag ) : void
static

Indicate whether parser should ignore constants or not

Parameters
Name Type Description
$flag bool
methodpublicsetYamlDecoder( \callable $yamlDecoder ) : \Zend_Config_Yaml

Set callback for decoding YAML

Parameters
Name Type Description
$yamlDecoder \callable

the decoder to set

Returns
Type Description
\Zend_Config_Yaml
Documentation was generated by DocBlox 0.15.1.