4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Serializer\Encoder;
14 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
17 * Defines the interface of encoders.
19 * @author Jordi Boggiano <j.boggiano@seld.be>
21 interface EncoderInterface
24 * Encodes data into the given format.
26 * @param mixed $data Data to encode
27 * @param string $format Format name
28 * @param array $context Options that normalizers/encoders have access to
30 * @return string|int|float|bool
32 * @throws UnexpectedValueException
34 public function encode($data, $format, array $context = array());
37 * Checks whether the serializer can encode to given format.
39 * @param string $format Format name
43 public function supportsEncoding($format);