SerializerInterface.php 915 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. * @author Jordi Boggiano <j.boggiano@seld.be>
  13. */
  14. interface SerializerInterface
  15. {
  16. /**
  17. * Serializes data in the appropriate format.
  18. *
  19. * @param mixed $data Any data
  20. * @param string $format Format name
  21. * @param array $context Options normalizers/encoders have access to
  22. *
  23. * @return string
  24. */
  25. public function serialize($data, string $format, array $context = []);
  26. /**
  27. * Deserializes data into the given type.
  28. *
  29. * @param mixed $data
  30. *
  31. * @return mixed
  32. */
  33. public function deserialize($data, string $type, string $format, array $context = []);
  34. }