Drupal investigation

DecoderInterface.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 decoders.
  14. *
  15. * @author Jordi Boggiano <j.boggiano@seld.be>
  16. */
  17. interface DecoderInterface
  18. {
  19. /**
  20. * Decodes a string into PHP data.
  21. *
  22. * @param string $data Data to decode
  23. * @param string $format Format name
  24. * @param array $context options that decoders have access to
  25. *
  26. * The format parameter specifies which format the data is in; valid values
  27. * depend on the specific implementation. Authors implementing this interface
  28. * are encouraged to document which formats they support in a non-inherited
  29. * phpdoc comment.
  30. *
  31. * @return mixed
  32. *
  33. * @throws UnexpectedValueException
  34. */
  35. public function decode($data, $format, array $context = array());
  36. /**
  37. * Checks whether the deserializer can decode from given format.
  38. *
  39. * @param string $format format name
  40. *
  41. * @return bool
  42. */
  43. public function supportsDecoding($format);
  44. }