Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Component\Serializer\Normalizer;
|
Chris@0
|
13
|
Chris@12
|
14 use Symfony\Component\Serializer\Exception\BadMethodCallException;
|
Chris@12
|
15 use Symfony\Component\Serializer\Exception\ExtraAttributesException;
|
Chris@12
|
16 use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
Chris@12
|
17 use Symfony\Component\Serializer\Exception\LogicException;
|
Chris@12
|
18 use Symfony\Component\Serializer\Exception\RuntimeException;
|
Chris@12
|
19 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
Chris@12
|
20
|
Chris@0
|
21 /**
|
Chris@0
|
22 * Defines the interface of denormalizers.
|
Chris@0
|
23 *
|
Chris@0
|
24 * @author Jordi Boggiano <j.boggiano@seld.be>
|
Chris@0
|
25 */
|
Chris@0
|
26 interface DenormalizerInterface
|
Chris@0
|
27 {
|
Chris@0
|
28 /**
|
Chris@0
|
29 * Denormalizes data back into an object of the given class.
|
Chris@0
|
30 *
|
Chris@0
|
31 * @param mixed $data data to restore
|
Chris@0
|
32 * @param string $class the expected class to instantiate
|
Chris@0
|
33 * @param string $format format the given data was extracted from
|
Chris@0
|
34 * @param array $context options available to the denormalizer
|
Chris@0
|
35 *
|
Chris@0
|
36 * @return object
|
Chris@12
|
37 *
|
Chris@12
|
38 * @throws BadMethodCallException Occurs when the normalizer is not called in an expected context
|
Chris@12
|
39 * @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported
|
Chris@12
|
40 * @throws UnexpectedValueException Occurs when the item cannot be hydrated with the given data
|
Chris@12
|
41 * @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data
|
Chris@12
|
42 * @throws LogicException Occurs when the normalizer is not supposed to denormalize
|
Chris@12
|
43 * @throws RuntimeException Occurs if the class cannot be instantiated
|
Chris@0
|
44 */
|
Chris@0
|
45 public function denormalize($data, $class, $format = null, array $context = array());
|
Chris@0
|
46
|
Chris@0
|
47 /**
|
Chris@0
|
48 * Checks whether the given class is supported for denormalization by this normalizer.
|
Chris@0
|
49 *
|
Chris@0
|
50 * @param mixed $data Data to denormalize from
|
Chris@0
|
51 * @param string $type The class to which the data should be denormalized
|
Chris@0
|
52 * @param string $format The format being deserialized from
|
Chris@0
|
53 *
|
Chris@0
|
54 * @return bool
|
Chris@0
|
55 */
|
Chris@0
|
56 public function supportsDenormalization($data, $type, $format = null);
|
Chris@0
|
57 }
|