| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <[email protected]> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Symfony\Component\Serializer\Encoder; |
| 13 | |
| 14 | use Symfony\Component\Serializer\Exception\UnexpectedValueException; |
| 15 | |
| 16 | /** |
| 17 | * @author Jordi Boggiano <[email protected]> |
| 18 | */ |
| 19 | interface EncoderInterface |
| 20 | { |
| 21 | /** |
| 22 | * Encodes data into the given format. |
| 23 | * |
| 24 | * @param mixed $data Data to encode |
| 25 | * @param string $format Format name |
| 26 | * @param array $context Options that normalizers/encoders have access to |
| 27 | * |
| 28 | * @throws UnexpectedValueException |
| 29 | */ |
| 30 | public function encode(mixed $data, string $format, array $context = []): string; |
| 31 | |
| 32 | /** |
| 33 | * Checks whether the serializer can encode to given format. |
| 34 | * |
| 35 | * @param string $format Format name |
| 36 | */ |
| 37 | public function supportsEncoding(string $format): bool; |
| 38 | } |