API Documentation

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 license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Config  
version
$Id: Yaml.php 24092 2011-05-31 02:43:28Z adamlundrigan $  

\Zend_Config_Yaml

YAML Adapter for Zend_Config

Extends from
\Zend_Config
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Config  

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'

What to call when we need to decode some YAML?

Default valuearrayDetails
Type
\callable

Methods

methodpublic__clone( ) : void

Deep clone of this instance to ensure that nested Zend_Configs are also cloned.

Inherited from: \Zend_Config::__clone()
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
methodpublic__get( string $name ) : mixed

Magic function so that $obj->value will work.

Inherited from: \Zend_Config::__get()
Parameters
Name Type Description
$name string
Returns
Type Description
mixed
methodpublic__isset( string $name ) : boolean

Support isset() overloading on PHP 5.1

Inherited from: \Zend_Config::__isset()
Parameters
Name Type Description
$name string
Returns
Type Description
boolean
methodpublic__set( string $name, mixed $value ) : void

Only allow setting of a property if $allowModifications was set to true on construction. Otherwise, throw an exception.

Inherited from: \Zend_Config::__set()
Parameters
Name Type Description
$name string
$value mixed
Throws
Exception Description
\Zend_Config_Exception
methodpublic__unset( string $name ) : void

Support unset() overloading on PHP 5.1

Inherited from: \Zend_Config::__unset()
Parameters
Name Type Description
$name string
Throws
Exception Description
\Zend_Config_Exception
methodprotected_arrayMergeRecursive( mixed $firstArray, mixed $secondArray ) : array

Merge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.

Inherited from: \Zend_Config::_arrayMergeRecursive()
Parameters
Name Type Description
$firstArray mixed First array
$secondArray mixed Second array to merge into first array
Returns
Type Description
array
methodprotected_assertValidExtend( string $extendingSection, string $extendedSection ) : void

Throws an exception if $extendingSection may not extend $extendedSection, and tracks the section extension if it is valid.

Inherited from: \Zend_Config::_assertValidExtend()
Parameters
Name Type Description
$extendingSection string
$extendedSection string
Throws
Exception Description
\Zend_Config_Exception
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
arraystring
methodprotected_getConstants( ) : array
static

Get (reverse) sorted list of defined constant names

Returns
Type Description
array
methodprotected_loadFileErrorHandler( integer $errno, string $errstr, string $errfile, integer $errline ) : void

Handle any errors from simplexml_load_file or parse_ini_file

Inherited from: \Zend_Config::_loadFileErrorHandler()
Parameters
Name Type Description
$errno integer
$errstr string
$errfile string
$errline integer
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
methodpublicareAllSectionsLoaded( ) : boolean

Returns true if all sections were loaded

Inherited from: \Zend_Config::areAllSectionsLoaded()
Returns
Type Description
boolean
methodpubliccount( ) : int

Defined by Countable interface

Inherited from: \Zend_Config::count()
Returns
Type Description
int
methodpubliccurrent( ) : mixed

Defined by Iterator interface

Inherited from: \Zend_Config::current()
Returns
Type Description
mixed
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
methodpublicget( string $name, mixed $default = null ) : mixed

Retrieve a value and return $default if there is no element set.

Inherited from: \Zend_Config::get()
Parameters
Name Type Description
$name string
$default mixed
Returns
Type Description
mixed
methodpublicgetExtends( ) : array

Get the current extends

Inherited from: \Zend_Config::getExtends()
Returns
Type Description
array
methodpublicgetSectionName( ) : mixed

Returns the section name(s) loaded.

Inherited from: \Zend_Config::getSectionName()
Returns
Type Description
mixed
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
methodpublickey( ) : mixed

Defined by Iterator interface

Inherited from: \Zend_Config::key()
Returns
Type Description
mixed
methodpublicmerge( \Zend_Config $merge ) : \Zend_Config

Merge another Zend_Config with this one. The items in $merge will override the same named items in the current config.

Inherited from: \Zend_Config::merge()
Parameters
Name Type Description
$merge \Zend_Config
Returns
Type Description
\Zend_Config
methodpublicnext( ) : void

Defined by Iterator interface

Inherited from: \Zend_Config::next()
methodpublicreadOnly( ) : boolean

Returns if this Zend_Config object is read only or not.

Inherited from: \Zend_Config::readOnly()
Returns
Type Description
boolean
methodpublicrewind( ) : void

Defined by Iterator interface

Inherited from: \Zend_Config::rewind()
methodpublicsetExtend( string $extendingSection, string $extendedSection = null ) : void

Set an extend for Zend_Config_Writer

Inherited from: \Zend_Config::setExtend()
Parameters
Name Type Description
$extendingSection string
$extendedSection string
methodpublicsetIgnoreConstants( bool $flag ) : void
static

Indicate whether parser should ignore constants or not

Parameters
Name Type Description
$flag bool
methodpublicsetReadOnly( ) : void

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.

Inherited from: \Zend_Config::setReadOnly()
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
methodpublictoArray( ) : array

Return an associative array of the stored data.

Inherited from: \Zend_Config::toArray()
Returns
Type Description
array
methodpublicvalid( ) : boolean

Defined by Iterator interface

Inherited from: \Zend_Config::valid()
Returns
Type Description
boolean
Documentation was generated by DocBlox 0.13.3.