function Yaml::encode

Same name in other branches
  1. 9 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()
  2. 10 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()
  3. 11.x core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::encode()

Overrides SerializationInterface::encode

6 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.
InstallerExistingConfigTestBase::prepareEnvironment in core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php
Prepares the current environment for running the test.
MultipleDistributionsProfileTest::prepareEnvironment in core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
Prepares the current environment for running the test.
UpdateScriptTest::testExtensionCompatibilityChange in core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php
Tests that extension compatibility changes are handled correctly.

... See full list

File

core/lib/Drupal/Component/Serialization/Yaml.php, line 22

Class

Yaml
Provides a YAML serialization implementation.

Namespace

Drupal\Component\Serialization

Code

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.