Properties

$_haveRefs

$_haveRefs : array

List of nodes with references

Type

array

$_allNodes

$_allNodes : array

All nodes

Type

array

$_allParent

$_allParent : array

Array of node parents

Type

array

$_lastIndent

$_lastIndent : integer

Last indent level

Type

integer

$_lastNode

$_lastNode : integer

Last node id

Type

integer

$_inBlock

$_inBlock : boolean|string

Is the parser inside a block?

Contains the block character (| or >) if inside a block.

Type

boolean|string

$_lineEnd

$_lineEnd : string

Type

string

$_blockEnd

$_blockEnd : string

Type

string

$_isInline

$_isInline : boolean

Type

boolean

$_nodeId

$_nodeId : integer

Next node id to use

Type

integer

$_lineNumber

$_lineNumber : integer

Last line number parsed.

Type

integer

Methods

__construct()

__construct() 

Create a new YAML parser.

toArray()

toArray() : array

Returns the PHP built from all YAML parsed so far.

Returns

array —

PHP version of parsed YAML.

parse()

parse(string  $line) : \Horde_Yaml_Node

Parses a line of a YAML file.

Parameters

string $line

The line of YAML to parse.

Returns

\Horde_Yaml_Node

YAML Node.

_getIndent()

_getIndent(string  $line) : integer

Finds and returns the indentation of a YAML line.

Parameters

string $line

A line from the YAML file.

Returns

integer —

Indentation level.

_parseLine()

_parseLine(string  $line) : array

Parses YAML code and returns an array for a node.

Parameters

string $line

A line from the YAML file.

Returns

array

_toType()

_toType(string  $value) : mixed

Finds the type of the passed value, returns the value as the new type.

Parameters

string $value

Returns

mixed

_unserialize()

_unserialize(  $data) 

Handles PHP serialized data.

Parameters

$data

_inlineEscape()

_inlineEscape(string  $inline) : array

Used in inlines to check for more inlines or quoted strings

Parameters

string $inline

Inline data.

Returns

array

_buildArray()

_buildArray() : array

Builds the PHP array from all the YAML nodes we've gathered.

Returns

array

_linkReferences()

_linkReferences() 

Traverses node-space and sets references (& and *) accordingly.

_linkRef()

_linkRef(\Horde_Yaml_Node  $n,   $key, string  $k = null, mixed  $v = null) 

Helper for _linkReferences().

Parameters

\Horde_Yaml_Node $n

Node.

$key
string $k

Key.

mixed $v

Value.

_gatherChildren()

_gatherChildren(integer  $nid) : array

Finds the children of a node and aids in the building of the PHP array

Parameters

integer $nid

The id of the node whose children we're gathering

Returns

array

_nodeArrayizeData()

_nodeArrayizeData(array  $node) 

Turns a node's data and its children's data into a PHP array

Parameters

array $node

The node which you want to arrayize.

_makeReferences()

_makeReferences(\Horde_Yaml_Node  $z) 

Traverses node-space and copies references to / from this object.

Parameters

\Horde_Yaml_Node $z

A node whose references we wish to make real.

_array_kmerge()

_array_kmerge(array  $arr1, array  $arr2) : array

Merges two arrays, maintaining numeric keys.

If two numeric keys clash, the second one will be appended to the resulting array. If string keys clash, the last one wins.

Parameters

array $arr1
array $arr2

Returns

array