PHP Class Zend_Config_Yaml

Inheritance: extends Zend_Config
Show file Open project: dbpatch/dbpatch Class Usage Examples

Protected Properties

Property Type Description
$_ignoreConstants boolean Whether or not to ignore constants in parsed YAML
$_skipExtends boolean Whether to skip extends or not
$_yamlDecoder callable What to call when we need to decode some YAML?

Public Methods

Method Description
__construct ( string $yaml, mixed $section = null, boolean $options = false ) Loads the section $section from the config file encoded as YAML
decode ( string $yaml ) : array Very dumb YAML parser
getYamlDecoder ( ) : callable Get callback for decoding YAML
ignoreConstants ( ) : boolean Whether parser should ignore constants or not
setIgnoreConstants ( boolean $flag ) : void Indicate whether parser should ignore constants or not
setYamlDecoder ( callable $yamlDecoder ) : Zend_Config_Yaml Set callback for decoding YAML

Protected Methods

Method Description
_decodeYaml ( integer $currentIndent, array &$lines ) : array | string Service function to decode YAML
_getConstants ( ) : array Get (reverse) sorted list of defined constant names
_processExtends ( array $data, string $section, array $config = [] ) : array Helper function to process each element in the section and handle the "_extends" inheritance attribute.
_replaceConstants ( string $value ) : string Replace any constants referenced in a string with their values

Method Details

__construct() public method

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
public __construct ( string $yaml, mixed $section = null, boolean $options = false )
$yaml string YAML file to process
$section mixed Section to process
$options boolean Whether modifiacations are allowed at runtime

_decodeYaml() protected static method

Service function to decode YAML
protected static _decodeYaml ( integer $currentIndent, array &$lines ) : array | string
$currentIndent integer Current indent level
$lines array YAML lines
return array | string

_getConstants() protected static method

Get (reverse) sorted list of defined constant names
protected static _getConstants ( ) : array
return array

_processExtends() protected method

Helper function to process each element in the section and handle the "_extends" inheritance attribute.
protected _processExtends ( array $data, string $section, array $config = [] ) : array
$data array Data array to process
$section string Section to process
$config array Configuration which was parsed yet
return array

_replaceConstants() protected static method

Replace any constants referenced in a string with their values
protected static _replaceConstants ( string $value ) : string
$value string
return string

decode() public static method

Until we have Zend_Yaml...
public static decode ( string $yaml ) : array
$yaml string YAML source
return array Decoded data

getYamlDecoder() public method

Get callback for decoding YAML
public getYamlDecoder ( ) : callable
return callable

ignoreConstants() public static method

Whether parser should ignore constants or not
public static ignoreConstants ( ) : boolean
return boolean

setIgnoreConstants() public static method

Indicate whether parser should ignore constants or not
public static setIgnoreConstants ( boolean $flag ) : void
$flag boolean
return void

setYamlDecoder() public method

Set callback for decoding YAML
public setYamlDecoder ( callable $yamlDecoder ) : Zend_Config_Yaml
$yamlDecoder callable the decoder to set
return Zend_Config_Yaml

Property Details

$_ignoreConstants protected static property

Whether or not to ignore constants in parsed YAML
protected static bool $_ignoreConstants
return boolean

$_skipExtends protected property

Whether to skip extends or not
protected bool $_skipExtends
return boolean

$_yamlDecoder protected property

What to call when we need to decode some YAML?
protected callable $_yamlDecoder
return callable