public static function Yaml::encode in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()
- 10 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()
Encodes data into the serialization format.
Parameters
mixed $data: The data to encode.
Return value
string The encoded data.
Throws
\Drupal\Component\Serialization\Exception\InvalidDataTypeException
Overrides SerializationInterface::encode
8 calls to Yaml::encode()
- DistributionProfileExistingSettingsTest::prepareEnvironment in core/
tests/ Drupal/ FunctionalTests/ Installer/ DistributionProfileExistingSettingsTest.php - Prepares the current environment for running the test.
- ExtensionListTest::setupTestExtensionList in core/
tests/ Drupal/ Tests/ Core/ Extension/ ExtensionListTest.php - Sets up an a test extension list.
- FrontMatterTest::createFrontMatterSource in core/
tests/ Drupal/ Tests/ Component/ FrontMatter/ FrontMatterTest.php - Creates a front matter source string.
- GenerateTheme::execute in core/
lib/ Drupal/ Core/ Command/ GenerateTheme.php - InstallerExistingConfigTestBase::prepareEnvironment in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerExistingConfigTestBase.php - Prepares the current environment for running the test.
File
- core/
lib/ Drupal/ Component/ Serialization/ Yaml.php, line 22
Class
- Yaml
- Provides a YAML serialization implementation.
Namespace
Drupal\Component\SerializationCode
public static function encode($data) {
// Instead of using \Drupal\Component\Serialization\Yaml::getSerializer(),
// always using Symfony for writing the data, to reduce the risk of having
// differences if different environments (like production and development)
// do not match in terms of what YAML implementation is available.
return YamlSymfony::encode($data);
}