YamlSymfony::decode

public static YamlSymfony::decode($raw)

Decodes data from the serialization format.

Parameters

string $raw: The raw data string to decode.

Return value

mixed The decoded data.

Overrides SerializationInterface::decode

File

core/lib/Drupal/Component/Serialization/YamlSymfony.php, line 31

Class

YamlSymfony
Default serialization for YAML using the Symfony component.

Namespace

Drupal\Component\Serialization

Code

1
2
3
4
5
6
7
8
9
10
11
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);
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.