public static function Yaml::parse in Lockr 7.3
Parses YAML into a PHP value.
Usage: <code> $array = Yaml::parse(file_get_contents('config.yml')); print_r($array); </code>
Parameters
string $input A string containing YAML:
int $flags A bit field of PARSE_* constants to customize the YAML parser behavior:
Return value
mixed The YAML converted to a PHP value
Throws
ParseException If the YAML is not valid
17 calls to Yaml::parse()
- DumperTest::testDumpObjectAsMap in vendor/
symfony/ yaml/ Tests/ DumperTest.php - @dataProvider objectAsMapProvider
- InlineTest::testExplicitStringCastingOfMappingKeys in vendor/
symfony/ yaml/ Tests/ InlineTest.php - @group legacy @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead. @expectedDeprecation Implicit casting of incompatible mapping…
- Lockr::importSecretData in vendor/
lockr/ lockr/ src/ Lockr.php - Imports secret data from YAML.
- ParserTest::testCommentAtTheRootIndent in vendor/
symfony/ yaml/ Tests/ ParserTest.php - ParserTest::testEmptyValue in vendor/
symfony/ yaml/ Tests/ ParserTest.php
File
- vendor/
symfony/ yaml/ Yaml.php, line 80
Class
- Yaml
- Yaml offers convenience methods to load and dump YAML.
Namespace
Symfony\Component\YamlCode
public static function parse($input, $flags = 0) {
if (\is_bool($flags)) {
@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);
if ($flags) {
$flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE;
}
else {
$flags = 0;
}
}
if (\func_num_args() >= 3) {
@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);
if (func_get_arg(2)) {
$flags |= self::PARSE_OBJECT;
}
}
if (\func_num_args() >= 4) {
@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);
if (func_get_arg(3)) {
$flags |= self::PARSE_OBJECT_FOR_MAP;
}
}
$yaml = new Parser();
return $yaml
->parse($input, $flags);
}