Class Parser
Parser parses YAML strings to convert them to PHP arrays.
Methods summary
public
|
#
__construct( integer $offset = 0 )
Constructor.
Parameters
- $offset
- The offset of YAML document (used for line numbers in error messages)
|
public
mixed
|
#
parse( string $value, boolean $exceptionOnInvalidType = false, boolean $objectSupport = false, boolean $objectForMap = false )
Parses a YAML string to a PHP value.
Parses a YAML string to a PHP value.
Parameters
- $value
- A YAML string
- $exceptionOnInvalidType
- true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
- $objectSupport
- true if object support is enabled, false otherwise
- $objectForMap
- true if maps should return a stdClass instead of array()
Returns
mixed A PHP value
Throws
|
Constants summary
string |
FOLDED_SCALAR_PATTERN
|
#
'(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?'
|