You are here

public static function Yaml::decode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Component/Serialization/Yaml.php \Drupal\Component\Serialization\Yaml::decode()

Decodes data from the serialization format.

Parameters

string $raw: The raw data string to decode.

Return value

mixed The decoded data.

Overrides SerializationInterface::decode

20 calls to Yaml::decode()
ConfigExportUITest::testExport in core/modules/config/src/Tests/ConfigExportUITest.php
Tests export of configuration.
ConfigInstallProfileUnmetDependenciesTest::setUp in core/modules/config/src/Tests/ConfigInstallProfileUnmetDependenciesTest.php
Sets up a Drupal site for running functional and integration tests.
ConfigSingleImportForm::validateForm in core/modules/config/src/Form/ConfigSingleImportForm.php
Form validation handler.
drupal-8.block-context-manager-2354889.php in core/modules/system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php
Contains database additions to drupal-8.bare.standard.php.gz for testing the upgrade path of https://www.drupal.org/node/2354889.
drupal-8.local-actions-tasks-into-blocks-507488.php in core/modules/system/tests/fixtures/update/drupal-8.local-actions-tasks-into-blocks-507488.php
Contains database additions to drupal-8.bare.standard.php.gz for testing the upgrade path of https://www.drupal.org/node/507488.

... See full list

File

core/lib/Drupal/Component/Serialization/Yaml.php, line 36
Contains \Drupal\Component\Serialization\Yaml.

Class

Yaml
Default serialization for YAML using the Symfony component.

Namespace

Drupal\Component\Serialization

Code

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, TRUE, FALSE);
  } catch (\Exception $e) {
    throw new InvalidDataTypeException($e
      ->getMessage(), $e
      ->getCode(), $e);
  }
}