48 public static function parse($input, $flags = 0)
50 if (is_bool($flags)) {
51 @trigger_error(
'Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
60 if (func_num_args() >= 3) {
61 @trigger_error(
'Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', E_USER_DEPRECATED);
63 if (func_get_arg(2)) {
68 if (func_num_args() >= 4) {
69 @trigger_error(
'Passing a boolean flag to toggle object for map support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED);
71 if (func_get_arg(3)) {
78 return $yaml->parse($input, $flags);
94 public static function dump($input, $inline = 2, $indent = 4, $flags = 0)
96 if (is_bool($flags)) {
97 @trigger_error(
'Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
106 if (func_num_args() >= 5) {
107 @trigger_error(
'Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
109 if (func_get_arg(4)) {
114 $yaml =
new Dumper($indent);
116 return $yaml->dump($input, $inline, 0, $flags);
An exception for terminatinating execution or to throw for unit testing.
Dumper dumps PHP variables to YAML strings.
Exception class thrown when an error occurs during parsing.
Parser parses YAML strings to convert them to PHP arrays.
Yaml offers convenience methods to load and dump YAML.
const DUMP_MULTI_LINE_LITERAL_BLOCK
static parse($input, $flags=0)
Parses YAML into a PHP value.
const PARSE_OBJECT_FOR_MAP
const DUMP_EXCEPTION_ON_INVALID_TYPE
static dump($input, $inline=2, $indent=4, $flags=0)
Dumps a PHP value to a YAML string.
const PARSE_EXCEPTION_ON_INVALID_TYPE