Drupal investigation

EncoderInterface.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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\Encoder;
  11. use Symfony\Component\Serializer\Exception\UnexpectedValueException;
  12. /**
  13. * Defines the interface of encoders.
  14. *
  15. * @author Jordi Boggiano <j.boggiano@seld.be>
  16. */
  17. interface EncoderInterface
  18. {
  19. /**
  20. * Encodes data into the given format.
  21. *
  22. * @param mixed $data Data to encode
  23. * @param string $format Format name
  24. * @param array $context options that normalizers/encoders have access to
  25. *
  26. * @return scalar
  27. *
  28. * @throws UnexpectedValueException
  29. */
  30. public function encode($data, $format, array $context = array());
  31. /**
  32. * Checks whether the serializer can encode to given format.
  33. *
  34. * @param string $format format name
  35. *
  36. * @return bool
  37. */
  38. public function supportsEncoding($format);
  39. }