DenormalizableInterface.php 1.5 KB

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\Normalizer;
  11. /**
  12. * Defines the most basic interface a class must implement to be denormalizable.
  13. *
  14. * If a denormalizer is registered for the class and it doesn't implement
  15. * the Denormalizable interfaces, the normalizer will be used instead
  16. *
  17. * @author Jordi Boggiano <j.boggiano@seld.be>
  18. */
  19. interface DenormalizableInterface
  20. {
  21. /**
  22. * Denormalizes the object back from an array of scalars|arrays.
  23. *
  24. * It is important to understand that the denormalize() call should denormalize
  25. * recursively all child objects of the implementor.
  26. *
  27. * @param DenormalizerInterface $denormalizer The denormalizer is given so that you
  28. * can use it to denormalize objects contained within this object
  29. * @param array|string|int|float|bool $data The data from which to re-create the object
  30. * @param string|null $format The format is optionally given to be able to denormalize
  31. * differently based on different input formats
  32. * @param array $context Options for denormalizing
  33. */
  34. public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []);
  35. }