1 | <?php |
||
32 | class HateoasSerializer implements ResourceSerializerInterface |
||
33 | { |
||
34 | /** |
||
35 | * @var SerializerInterface |
||
36 | */ |
||
37 | private $serializer; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private $format; |
||
43 | |||
44 | /** |
||
45 | * @var array|NormalizerInterface[] |
||
46 | */ |
||
47 | private $normalizers; |
||
48 | |||
49 | /** |
||
50 | * Constructor. |
||
51 | * |
||
52 | * @param SerializerInterface $serializer |
||
53 | * @param array $normalizers |
||
54 | * @param string $format |
||
55 | */ |
||
56 | 2 | public function __construct(SerializerInterface $serializer, array $normalizers, string $format) |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 1 | public function serialize(ResourceInterface $resource, ResourceSerializationContext $context): string |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | * |
||
81 | * @throws DeserializationNotSupportException |
||
82 | */ |
||
83 | 1 | public function deserialize(string $data, string $resourceClass, ResourceSerializationContext $context): ResourceInterface |
|
87 | |||
88 | /** |
||
89 | * Fix relations after normalization |
||
90 | * |
||
91 | * @param array $data |
||
92 | * |
||
93 | * @return array |
||
94 | */ |
||
95 | 1 | protected function fixRelations(array $data): array |
|
115 | } |
||
116 |