NormalizableInterface.php 851 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace JMS\SerializerBundle\Serializer\Normalizer;
  3. use JMS\SerializerBundle\Serializer\SerializerInterface;
  4. /**
  5. * This interface can be implemented by domain objects if they contain the
  6. * normalization logic themselves.
  7. *
  8. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  9. */
  10. interface NormalizableInterface
  11. {
  12. /**
  13. * Normalizes the implementing object.
  14. *
  15. * @param SerializerInterface $serializer
  16. * @param string $format
  17. *
  18. * @return mixed
  19. */
  20. function normalize(SerializerInterface $serializer, $format = null);
  21. /**
  22. * Denormalizes the implementing object.
  23. *
  24. * @param SerializerInterface $serializer
  25. * @param mixed $data
  26. * @param string $format
  27. *
  28. * @return void
  29. */
  30. function denormalize(SerializerInterface $serializer, $data, $format = null);
  31. }