public static YamlSymfony::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/YamlSymfony.php, line 17
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 | public static function encode( $data ) { try { $yaml = new Dumper(); $yaml ->setIndentation(2); return $yaml ->dump( $data , PHP_INT_MAX, 0, TRUE, FALSE); } catch (\Exception $e ) { throw new InvalidDataTypeException( $e ->getMessage(), $e ->getCode(), $e ); } } |
Please login to continue.