Parser
class Parser
Parser parses YAML strings to convert them to PHP arrays.
Constants
BLOCK_SCALAR_HEADER_PATTERN |
Methods
__construct(int $offset) Constructor. | ||
mixed | parse(string $value, bool $exceptionOnInvalidType = false, bool $objectSupport = false, bool $objectForMap = false) Parses a YAML string to a PHP value. |
Details
__construct(int $offset)
Constructor.
Parameters
int | $offset | The offset of YAML document (used for line numbers in error messages) |
mixed parse(string $value, bool $exceptionOnInvalidType = false, bool $objectSupport = false, bool $objectForMap = false)
Parses a YAML string to a PHP value.
Parameters
string | $value | A YAML string |
bool | $exceptionOnInvalidType | true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise |
bool | $objectSupport | true if object support is enabled, false otherwise |
bool | $objectForMap | true if maps should return a stdClass instead of array() |
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.0/Symfony/Component/Yaml/Parser.html