1 | <?php |
||
11 | final class Serializer implements SerializerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var NormalizerInterface |
||
15 | */ |
||
16 | private $normalizer; |
||
17 | |||
18 | /** |
||
19 | * @var EncoderInterface |
||
20 | */ |
||
21 | private $encoder; |
||
22 | |||
23 | /** |
||
24 | * @param NormalizerInterface $normalizer |
||
25 | * @param EncoderInterface $encoder |
||
26 | */ |
||
27 | 4 | public function __construct(NormalizerInterface $normalizer, EncoderInterface $encoder) |
|
32 | |||
33 | /** |
||
34 | * @param object $object |
||
35 | * @param string $contentType |
||
36 | * @param NormalizerContextInterface $context |
||
37 | * @param string $path |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | 4 | public function serialize( |
|
49 | |||
50 | /** |
||
51 | * @param object $object |
||
52 | * @param NormalizerContextInterface|null $context |
||
53 | * @param string $path |
||
54 | * |
||
55 | * @return array |
||
56 | * |
||
57 | * @throws SerializerLogicException |
||
58 | */ |
||
59 | public function normalize($object, NormalizerContextInterface $context = null, string $path = ''): array |
||
63 | |||
64 | /** |
||
65 | * @return string[] |
||
66 | */ |
||
67 | public function getContentTypes(): array |
||
71 | |||
72 | /** |
||
73 | * @param array $data |
||
74 | * @param string $contentType |
||
75 | * |
||
76 | * @return string |
||
77 | * |
||
78 | * @throws SerializerLogicException |
||
79 | */ |
||
80 | public function encode(array $data, string $contentType): string |
||
84 | } |
||
85 |