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