Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/yaml/Yaml.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
40 const PARSE_KEYS_AS_STRINGS = 2048; | 40 const PARSE_KEYS_AS_STRINGS = 2048; |
41 | 41 |
42 /** | 42 /** |
43 * Parses a YAML file into a PHP value. | 43 * Parses a YAML file into a PHP value. |
44 * | 44 * |
45 * Usage: | 45 * Usage: |
46 * <code> | 46 * |
47 * $array = Yaml::parseFile('config.yml'); | 47 * $array = Yaml::parseFile('config.yml'); |
48 * print_r($array); | 48 * print_r($array); |
49 * </code> | |
50 * | 49 * |
51 * @param string $filename The path to the YAML file to be parsed | 50 * @param string $filename The path to the YAML file to be parsed |
52 * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior | 51 * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior |
53 * | 52 * |
54 * @return mixed The YAML converted to a PHP value | 53 * @return mixed The YAML converted to a PHP value |
78 * | 77 * |
79 * @throws ParseException If the YAML is not valid | 78 * @throws ParseException If the YAML is not valid |
80 */ | 79 */ |
81 public static function parse($input, $flags = 0) | 80 public static function parse($input, $flags = 0) |
82 { | 81 { |
83 if (is_bool($flags)) { | 82 if (\is_bool($flags)) { |
84 @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); | 83 @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); |
85 | 84 |
86 if ($flags) { | 85 if ($flags) { |
87 $flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE; | 86 $flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE; |
88 } else { | 87 } else { |
89 $flags = 0; | 88 $flags = 0; |
90 } | 89 } |
91 } | 90 } |
92 | 91 |
93 if (func_num_args() >= 3) { | 92 if (\func_num_args() >= 3) { |
94 @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', E_USER_DEPRECATED); | 93 @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', E_USER_DEPRECATED); |
95 | 94 |
96 if (func_get_arg(2)) { | 95 if (func_get_arg(2)) { |
97 $flags |= self::PARSE_OBJECT; | 96 $flags |= self::PARSE_OBJECT; |
98 } | 97 } |
99 } | 98 } |
100 | 99 |
101 if (func_num_args() >= 4) { | 100 if (\func_num_args() >= 4) { |
102 @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED); | 101 @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED); |
103 | 102 |
104 if (func_get_arg(3)) { | 103 if (func_get_arg(3)) { |
105 $flags |= self::PARSE_OBJECT_FOR_MAP; | 104 $flags |= self::PARSE_OBJECT_FOR_MAP; |
106 } | 105 } |
124 * | 123 * |
125 * @return string A YAML string representing the original PHP value | 124 * @return string A YAML string representing the original PHP value |
126 */ | 125 */ |
127 public static function dump($input, $inline = 2, $indent = 4, $flags = 0) | 126 public static function dump($input, $inline = 2, $indent = 4, $flags = 0) |
128 { | 127 { |
129 if (is_bool($flags)) { | 128 if (\is_bool($flags)) { |
130 @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); | 129 @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED); |
131 | 130 |
132 if ($flags) { | 131 if ($flags) { |
133 $flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE; | 132 $flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE; |
134 } else { | 133 } else { |
135 $flags = 0; | 134 $flags = 0; |
136 } | 135 } |
137 } | 136 } |
138 | 137 |
139 if (func_num_args() >= 5) { | 138 if (\func_num_args() >= 5) { |
140 @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', E_USER_DEPRECATED); | 139 @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', E_USER_DEPRECATED); |
141 | 140 |
142 if (func_get_arg(4)) { | 141 if (func_get_arg(4)) { |
143 $flags |= self::DUMP_OBJECT; | 142 $flags |= self::DUMP_OBJECT; |
144 } | 143 } |