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\Normalizer;
14 use Symfony\Component\Serializer\Exception\CircularReferenceException;
15 use Symfony\Component\Serializer\Exception\InvalidArgumentException;
16 use Symfony\Component\Serializer\Exception\LogicException;
19 * Defines the interface of normalizers.
21 * @author Jordi Boggiano <j.boggiano@seld.be>
23 interface NormalizerInterface
26 * Normalizes an object into a set of arrays/scalars.
28 * @param mixed $object Object to normalize
29 * @param string $format Format the normalization result will be encoded as
30 * @param array $context Context options for the normalizer
32 * @return array|string|int|float|bool
34 * @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer
35 * @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular
36 * reference handler can fix it
37 * @throws LogicException Occurs when the normalizer is not called in an expected context
39 public function normalize($object, $format = null, array $context = array());
42 * Checks whether the given class is supported for normalization by this normalizer.
44 * @param mixed $data Data to normalize
45 * @param string $format The format being (de-)serialized from or into
49 public function supportsNormalization($data, $format = null);