1: <?php
2:
3: namespace SellerLabs\Snagshout\Utils;
4:
5: use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
6: use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
7: use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer;
8:
9: class NullNormalizer extends SerializerAwareNormalizer implements DenormalizerInterface, NormalizerInterface
10: {
11: /**
12: * Denormalizes data back into an object of the given class.
13: *
14: * @param mixed $data data to restore
15: * @param string $class the expected class to instantiate
16: * @param string $format format the given data was extracted from
17: * @param array $context options available to the denormalizer
18: *
19: * @return object
20: */
21: public function denormalize($data, $class, $format = null, array $context = array())
22: {
23: return null;
24: }
25:
26: /**
27: * Checks whether the given class is supported for denormalization by this normalizer.
28: *
29: * @param mixed $data Data to denormalize from
30: * @param string $type The class to which the data should be denormalized
31: * @param string $format The format being deserialized from
32: *
33: * @return bool
34: */
35: public function supportsDenormalization($data, $type, $format = null)
36: {
37: return $data === null;
38: }
39:
40: /**
41: * Normalizes an object into a set of arrays/scalars.
42: *
43: * @param object $object object to normalize
44: * @param string $format format the normalization result will be encoded as
45: * @param array $context Context options for the normalizer
46: *
47: * @return array|scalar
48: */
49: public function normalize($object, $format = null, array $context = array())
50: {
51: return null;
52: }
53:
54: /**
55: * Checks whether the given class is supported for normalization by this normalizer.
56: *
57: * @param mixed $data Data to normalize
58: * @param string $format The format being (de-)serialized from or into
59: *
60: * @return bool
61: */
62: public function supportsNormalization($data, $format = null)
63: {
64: return false;
65: }
66: }