YamlPecl::encode

public static YamlPecl::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/YamlPecl.php, line 15

Class

YamlPecl
Provides default serialization for YAML using the PECL extension.

Namespace

Drupal\Component\Serialization

Code

public static function encode($data) {
  static $init;
  if (!isset($init)) {
    ini_set('yaml.output_indent', 2);
    // Do not break lines at 80 characters.
    ini_set('yaml.output_width', -1);
    $init = TRUE;
  }
  return yaml_emit($data, YAML_UTF8_ENCODING, YAML_LN_BREAK);
}
doc_Drupal
2016-10-29 09:57:01
Comments
Leave a Comment

Please login to continue.