Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Serializer\Normalizer; Chris@0: Chris@12: use Symfony\Component\Serializer\Exception\CircularReferenceException; Chris@17: use Symfony\Component\Serializer\Exception\ExceptionInterface; Chris@12: use Symfony\Component\Serializer\Exception\InvalidArgumentException; Chris@12: use Symfony\Component\Serializer\Exception\LogicException; Chris@12: Chris@0: /** Chris@0: * Defines the interface of normalizers. Chris@0: * Chris@0: * @author Jordi Boggiano Chris@0: */ Chris@0: interface NormalizerInterface Chris@0: { Chris@0: /** Chris@0: * Normalizes an object into a set of arrays/scalars. Chris@0: * Chris@16: * @param mixed $object Object to normalize Chris@14: * @param string $format Format the normalization result will be encoded as Chris@0: * @param array $context Context options for the normalizer Chris@0: * Chris@14: * @return array|string|int|float|bool Chris@12: * Chris@12: * @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer Chris@12: * @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular Chris@12: * reference handler can fix it Chris@12: * @throws LogicException Occurs when the normalizer is not called in an expected context Chris@17: * @throws ExceptionInterface Occurs for all the other cases of errors Chris@0: */ Chris@17: public function normalize($object, $format = null, array $context = []); Chris@0: Chris@0: /** Chris@0: * Checks whether the given class is supported for normalization by this normalizer. Chris@0: * Chris@0: * @param mixed $data Data to normalize Chris@0: * @param string $format The format being (de-)serialized from or into Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function supportsNormalization($data, $format = null); Chris@0: }