Yaml::encode

public static Yaml::encode($data)

Encodes data into the serialization format.

Parameters

mixed $data: The data to encode.

Return value

string The encoded data.

Overrides SerializationInterface::encode

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);
}
doc_Drupal
2016-10-29 09:56:54
Comments
Leave a Comment

Please login to continue.