function Yaml::decode
Same name in other branches
- 9 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::decode()
- 8.9.x core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::decode()
- 10 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::decode()
Overrides SerializationInterface::decode
18 calls to Yaml::decode()
- ConfigValidationTest::createRecipeWithInvalidDataInFile in core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ ConfigValidationTest.php - Creates a recipe with invalid config data in a particular file.
- ContentImportTest::testEntityValidationIsTriggered in core/
tests/ Drupal/ FunctionalTests/ DefaultContent/ ContentImportTest.php - Tests that the importer validates entities before saving them.
- entity-id-argument.php in core/
modules/ views/ tests/ fixtures/ update/ entity-id-argument.php - Test fixture.
- ExtensionListTest::setupTestExtensionList in core/
tests/ Drupal/ Tests/ Core/ Extension/ ExtensionListTest.php - Sets up an a test extension list.
- Finder::__construct in core/
lib/ Drupal/ Core/ DefaultContent/ Finder.php
File
-
core/
lib/ Drupal/ Component/ Serialization/ Yaml.php, line 32
Class
- Yaml
- Provides a YAML serialization implementation using symfony/yaml.
Namespace
Drupal\Component\SerializationCode
public static function decode($raw) {
try {
$yaml = new Parser();
// Make sure we have a single trailing newline. A very simple config like
// 'foo: bar' with no newline will fail to parse otherwise.
return $yaml->parse($raw, SymfonyYaml::PARSE_EXCEPTION_ON_INVALID_TYPE | SymfonyYaml::PARSE_CUSTOM_TAGS);
} catch (\Exception $e) {
throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.