SerializerInterface.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Serializer;
  11. /**
  12. * Defines the interface of the Serializer.
  13. *
  14. * @author Jordi Boggiano <j.boggiano@seld.be>
  15. */
  16. interface SerializerInterface
  17. {
  18. /**
  19. * Serializes data in the appropriate format.
  20. *
  21. * @param mixed $data any data
  22. * @param string $format format name
  23. * @param array $context options normalizers/encoders have access to
  24. *
  25. * @return string
  26. */
  27. public function serialize($data, $format, array $context = array());
  28. /**
  29. * Deserializes data into the given type.
  30. *
  31. * @param mixed $data
  32. * @param string $type
  33. * @param string $format
  34. * @param array $context
  35. *
  36. * @return object
  37. */
  38. public function deserialize($data, $type, $format, array $context = array());
  39. }