protected static function Yaml::getSerializer in Drupal 9
Same name in this branch
- 9 core/lib/Drupal/Core/Serialization/Yaml.php \Drupal\Core\Serialization\Yaml::getSerializer()
- 9 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::getSerializer()
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::getSerializer()
Determines which implementation to use for parsing YAML.
2 calls to Yaml::getSerializer()
- Yaml::decode in core/
lib/ Drupal/ Component/ Serialization/ Yaml.php - Decodes data from the serialization format.
- Yaml::getSerializer in core/
lib/ Drupal/ Core/ Serialization/ Yaml.php - Determines which implementation to use for parsing YAML.
2 methods override Yaml::getSerializer()
- Yaml::getSerializer in core/
lib/ Drupal/ Core/ Serialization/ Yaml.php - Determines which implementation to use for parsing YAML.
- YamlStub::getSerializer in core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php - Determines which implementation to use for parsing YAML.
File
- core/
lib/ Drupal/ Component/ Serialization/ Yaml.php, line 48
Class
- Yaml
- Provides a YAML serialization implementation.
Namespace
Drupal\Component\SerializationCode
protected static function getSerializer() {
if (!isset(static::$serializer)) {
// Use the PECL YAML extension if it is available. It has better
// performance for file reads and is YAML compliant.
if (extension_loaded('yaml')) {
static::$serializer = YamlPecl::class;
}
else {
// Otherwise, fallback to the Symfony implementation.
static::$serializer = YamlSymfony::class;
}
}
return static::$serializer;
}