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);
54 $flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE;
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)) {
64 $flags |= self::PARSE_OBJECT;
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)) {
72 $flags |= self::PARSE_OBJECT_FOR_MAP;
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);
100 $flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE;
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)) {
110 $flags |= self::DUMP_OBJECT;
114 $yaml =
new Dumper($indent);
116 return $yaml->dump($input, $inline, 0, $flags);
static dump($input, $inline=2, $indent=4, $flags=0)
Dumps a PHP value to a YAML string.
const PARSE_EXCEPTION_ON_INVALID_TYPE
const DUMP_MULTI_LINE_LITERAL_BLOCK
Yaml offers convenience methods to load and dump YAML.
static parse($input, $flags=0)
Parses YAML into a PHP value.
Parser parses YAML strings to convert them to PHP arrays.
Dumper dumps PHP variables to YAML strings.
const PARSE_OBJECT_FOR_MAP
const DUMP_EXCEPTION_ON_INVALID_TYPE