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\BadMethodCallException; Chris@17: use Symfony\Component\Serializer\Exception\ExceptionInterface; Chris@12: use Symfony\Component\Serializer\Exception\ExtraAttributesException; Chris@12: use Symfony\Component\Serializer\Exception\InvalidArgumentException; Chris@12: use Symfony\Component\Serializer\Exception\LogicException; Chris@12: use Symfony\Component\Serializer\Exception\RuntimeException; Chris@12: use Symfony\Component\Serializer\Exception\UnexpectedValueException; Chris@12: Chris@0: /** Chris@0: * Defines the interface of denormalizers. Chris@0: * Chris@0: * @author Jordi Boggiano Chris@0: */ Chris@0: interface DenormalizerInterface Chris@0: { Chris@0: /** Chris@0: * Denormalizes data back into an object of the given class. Chris@0: * Chris@14: * @param mixed $data Data to restore Chris@14: * @param string $class The expected class to instantiate Chris@14: * @param string $format Format the given data was extracted from Chris@14: * @param array $context Options available to the denormalizer Chris@0: * Chris@0: * @return object Chris@12: * Chris@12: * @throws BadMethodCallException Occurs when the normalizer is not called in an expected context Chris@12: * @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported Chris@12: * @throws UnexpectedValueException Occurs when the item cannot be hydrated with the given data Chris@12: * @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data Chris@12: * @throws LogicException Occurs when the normalizer is not supposed to denormalize Chris@12: * @throws RuntimeException Occurs if the class cannot be instantiated Chris@17: * @throws ExceptionInterface Occurs for all the other cases of errors Chris@0: */ Chris@17: public function denormalize($data, $class, $format = null, array $context = []); Chris@0: Chris@0: /** Chris@0: * Checks whether the given class is supported for denormalization by this normalizer. Chris@0: * Chris@0: * @param mixed $data Data to denormalize from Chris@0: * @param string $type The class to which the data should be denormalized Chris@0: * @param string $format The format being deserialized from Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function supportsDenormalization($data, $type, $format = null); Chris@0: }