SerializationInterface.php 763 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Drupal\Component\Serialization;
  3. /**
  4. * Defines an interface for serialization formats.
  5. */
  6. interface SerializationInterface {
  7. /**
  8. * Encodes data into the serialization format.
  9. *
  10. * @param mixed $data
  11. * The data to encode.
  12. *
  13. * @return string
  14. * The encoded data.
  15. */
  16. public static function encode($data);
  17. /**
  18. * Decodes data from the serialization format.
  19. *
  20. * @param string $raw
  21. * The raw data string to decode.
  22. *
  23. * @return mixed
  24. * The decoded data.
  25. */
  26. public static function decode($raw);
  27. /**
  28. * Gets the file extension for this serialization format.
  29. *
  30. * @return string
  31. * The file extension, without leading dot.
  32. */
  33. public static function getFileExtension();
  34. }