Parser
class Parser
Parser parses YAML strings to convert them to PHP arrays.
Constants
TAG_PATTERN | |
BLOCK_SCALAR_HEADER_PATTERN | |
Methods
mixed | parseFile(string $filename, int $flags = 0) Parses a YAML file into a PHP value. | |
mixed | parse(string $value, int $flags = 0) Parses a YAML string to a PHP value. | |
int | getLastLineNumberBeforeDeprecation() | |
int | getRealCurrentLineNb() Returns the current line number (takes the offset into account). | |
static int | preg_match(string $pattern, string $subject, array $matches = null, int $flags = 0, int $offset = 0) A local wrapper for preg_match which will throw a ParseException if there is an internal error in the PCRE engine. | |
Details
mixed
parseFile(string $filename, int $flags = 0)
Parses a YAML file into a PHP value.
Parameters
string | $filename | The path to the YAML file to be parsed |
int | $flags | A bit field of PARSE_* constants to customize the YAML parser behavior |
Return Value
mixed | The YAML converted to a PHP value |
Exceptions
mixed
parse(string $value, int $flags = 0)
Parses a YAML string to a PHP value.
Parameters
string | $value | A YAML string |
int | $flags | A bit field of PARSE_* constants to customize the YAML parser behavior |
Return Value
Exceptions
int
getLastLineNumberBeforeDeprecation()
Return Value
int
getRealCurrentLineNb()
Returns the current line number (takes the offset into account).
Return Value
int | The current line number |
static int
preg_match(string $pattern, string $subject, array $matches = null, int $flags = 0, int $offset = 0)
A local wrapper for preg_match
which will throw a ParseException if there is an internal error in the PCRE engine.
This avoids us needing to check for "false" every time PCRE is used in the YAML engine
Parameters
string | $pattern | |
string | $subject | |
array | $matches | |
int | $flags | |
int | $offset | |
Return Value
Exceptions
See also