Horde_Yaml_Loader
in package
Parse YAML strings into PHP data structures
Tags
Table of Contents
- $_allNodes : array<string|int, mixed>
- All nodes
- $_allParent : array<string|int, mixed>
- Array of node parents
- $_chomp : string
- The chomp mode (strip: '-', keep: '+', clip: '')
- $_haveRefs : array<string|int, mixed>
- List of nodes with references
- $_inBlock : bool|string
- Is the parser inside a block?
- $_indentSort : array<string|int, mixed>
- Nodes by indention level.
- $_isInline : bool
- $_lastIndent : int
- Last indent level
- $_lastNode : int
- Last node id
- $_lineEnd : string
- $_lineNumber : int
- Last line number parsed.
- $_nodeId : int
- Next node id to use
- $_ref : array<string|int, mixed>
- References
- __construct() : mixed
- Create a new YAML parser.
- parse() : mixed
- Parses a line of a YAML file.
- toArray() : array<string|int, mixed>
- Returns the PHP built from all YAML parsed so far.
- _array_kmerge() : array<string|int, mixed>
- Merges two arrays, maintaining numeric keys.
- _buildArray() : array<string|int, mixed>
- Builds the PHP array from all the YAML nodes we've gathered.
- _chomp() : mixed
- Chomps trailing white space if necessary.
- _gatherChildren() : array<string|int, mixed>
- Finds the children of a node and aids in the building of the PHP array
- _getIndent() : int
- Finds and returns the indentation of a YAML line.
- _inlineEscape() : array<string|int, mixed>
- Used in inlines to check for more inlines or quoted strings
- _linkRef() : mixed
- Helper for _linkReferences().
- _linkReferences() : mixed
- Traverses node-space and sets references (& and *) accordingly.
- _makeReferences() : mixed
- Traverses node-space and copies references to / from this object.
- _nodeArrayizeData() : mixed
- Turns a node's data and its children's data into a PHP array
- _parseLine() : array<string|int, mixed>
- Parses YAML code and returns an array for a node.
- _toType() : mixed
- Finds the type of the passed value, returns the value as the new type.
- _unserialize() : mixed
- Handles PHP serialized data.
Properties
$_allNodes
All nodes
protected
array<string|int, mixed>
$_allNodes
= array()
$_allParent
Array of node parents
protected
array<string|int, mixed>
$_allParent
= array()
$_chomp
The chomp mode (strip: '-', keep: '+', clip: '')
protected
string
$_chomp
= ''
$_haveRefs
List of nodes with references
protected
array<string|int, mixed>
$_haveRefs
= array()
$_inBlock
Is the parser inside a block?
protected
bool|string
$_inBlock
= \false
Contains the block character (| or >) if inside a block.
$_indentSort
Nodes by indention level.
protected
array<string|int, mixed>
$_indentSort
= array()
$_isInline
protected
bool
$_isInline
= \false
$_lastIndent
Last indent level
protected
int
$_lastIndent
= 0
$_lastNode
Last node id
protected
int
$_lastNode
= \null
$_lineEnd
protected
string
$_lineEnd
= ''
$_lineNumber
Last line number parsed.
protected
int
$_lineNumber
= 0
$_nodeId
Next node id to use
protected
int
$_nodeId
= 1
$_ref
References
protected
array<string|int, mixed>
$_ref
= array()
Methods
__construct()
Create a new YAML parser.
public
__construct() : mixed
Return values
mixed —parse()
Parses a line of a YAML file.
public
parse(string $line) : mixed
Parameters
- $line : string
-
The line of YAML to parse.
Tags
Return values
mixed —toArray()
Returns the PHP built from all YAML parsed so far.
public
toArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —PHP version of parsed YAML.
_array_kmerge()
Merges two arrays, maintaining numeric keys.
protected
_array_kmerge(array<string|int, mixed> $arr1, array<string|int, mixed> $arr2) : array<string|int, mixed>
If two numeric keys clash, the second one will be appended to the resulting array. If string keys clash, the last one wins.
Parameters
- $arr1 : array<string|int, mixed>
- $arr2 : array<string|int, mixed>
Return values
array<string|int, mixed> —_buildArray()
Builds the PHP array from all the YAML nodes we've gathered.
protected
_buildArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —_chomp()
Chomps trailing white space if necessary.
protected
_chomp() : mixed
Return values
mixed —_gatherChildren()
Finds the children of a node and aids in the building of the PHP array
protected
_gatherChildren(int $nid) : array<string|int, mixed>
Parameters
- $nid : int
-
The id of the node whose children we're gathering
Tags
Return values
array<string|int, mixed> —_getIndent()
Finds and returns the indentation of a YAML line.
protected
_getIndent(string $line) : int
Parameters
- $line : string
-
A line from the YAML file.
Return values
int —Indentation level.
_inlineEscape()
Used in inlines to check for more inlines or quoted strings
protected
_inlineEscape(string $inline) : array<string|int, mixed>
Parameters
- $inline : string
-
Inline data.
Tags
Return values
array<string|int, mixed> —_linkRef()
Helper for _linkReferences().
protected
_linkRef(Horde_Yaml_Node $n, string $key[, string $k = null ][, mixed $v = null ]) : mixed
Parameters
- $n : Horde_Yaml_Node
-
Node.
- $key : string
-
Key.
- $k : string = null
-
Key.
- $v : mixed = null
-
Value.
Return values
mixed —_linkReferences()
Traverses node-space and sets references (& and *) accordingly.
protected
_linkReferences() : mixed
Return values
mixed —_makeReferences()
Traverses node-space and copies references to / from this object.
protected
_makeReferences(Horde_Yaml_Node &$z) : mixed
Parameters
- $z : Horde_Yaml_Node
-
A node whose references we wish to make real.
Return values
mixed —_nodeArrayizeData()
Turns a node's data and its children's data into a PHP array
protected
_nodeArrayizeData(Horde_Yaml_Node &$node) : mixed
Parameters
- $node : Horde_Yaml_Node
-
The node which you want to arrayize.
Tags
Return values
mixed —_parseLine()
Parses YAML code and returns an array for a node.
protected
_parseLine(string $line) : array<string|int, mixed>
Parameters
- $line : string
-
A line from the YAML file.
Tags
Return values
array<string|int, mixed> —_toType()
Finds the type of the passed value, returns the value as the new type.
protected
_toType(string $value) : mixed
Parameters
- $value : string
Tags
Return values
mixed —_unserialize()
Handles PHP serialized data.
protected
_unserialize(string &$data) : mixed
Parameters
- $data : string
-
Data to check for serialized PHP types.