/
NormalizerInterface.php
64 lines (57 loc) · 1.83 KB
/
NormalizerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\SerializerInterface;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Defines the interface of normalizers.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
interface NormalizerInterface
{
/**
* Normalizes an object into a set of arrays/scalars
*
* @param object $object object to normalize
* @param string $format format the normalization result will be encoded as
* @return array|scalar
* @api
*/
function normalize($object, $format = null);
/**
* Denormalizes data back into an object of the given class
*
* @param mixed $data data to restore
* @param string $class the expected class to instantiate
* @param string $format format the given data was extracted from
* @return object
* @api
*/
function denormalize($data, $class, $format = null);
/**
* Checks whether the given class is supported for normalization by this normalizer
*
* @param mixed $data Data to normalize.
* @param string $format The format being (de-)serialized from or into.
* @return Boolean
* @api
*/
function supportsNormalization($data, $format = null);
/**
* Checks whether the given class is supported for denormalization by this normalizer
*
* @param mixed $data Data to denormalize from.
* @param string $type The class to which the data should be denormalized.
* @param string $format The format being deserialized from.
* @return Boolean
* @api
*/
function supportsDenormalization($data, $type, $format = null);
}