Parser

class Parser

Parser parses YAML strings to convert them to PHP arrays.

Constants

TAG_PATTERN
BLOCK_SCALAR_HEADER_PATTERN

Methods

__construct(int $offset, int|null $totalNumberOfLines = null, array $skippedLineNumbers = array())

Constructor.

mixed parse(string $value, int $flags)

Parses a YAML string to a PHP value.

Details

__construct(int $offset, int|null $totalNumberOfLines = null, array $skippedLineNumbers = array())

Constructor.

Parameters

int $offset The offset of YAML document (used for line numbers in error messages)
int|null $totalNumberOfLines The overall number of lines being parsed
array $skippedLineNumbers Number of comment lines that have been skipped by the parser

mixed parse(string $value, int $flags)

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

mixed A PHP value

Exceptions

ParseException If the YAML is not valid

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.1/Symfony/Component/Yaml/Parser.html