1 | <?php |
||
14 | class ConfiguredContextFactory implements SerializationContextFactoryInterface, DeserializationContextFactoryInterface |
||
15 | { |
||
16 | /** |
||
17 | * Application version |
||
18 | * |
||
19 | * @var null|string |
||
20 | */ |
||
21 | private $version; |
||
22 | |||
23 | /** |
||
24 | * Flag if we should serialize null values |
||
25 | * |
||
26 | * @var bool |
||
27 | */ |
||
28 | private $serializeNulls; |
||
29 | |||
30 | /** |
||
31 | * Key-value pairs with custom attributes |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private $attributes; |
||
36 | |||
37 | /** |
||
38 | * Serialization groups |
||
39 | * |
||
40 | * @var string[] |
||
41 | */ |
||
42 | private $groups; |
||
43 | |||
44 | /** |
||
45 | * ConfiguredContextFactory constructor. |
||
46 | * |
||
47 | * @param string|null $version Application version |
||
48 | * @param bool $serializeNulls Flag if we should serialize null values |
||
49 | * @param array $attributes Key-value pairs with custom attributes |
||
50 | * @param string[] $groups Serialization groups |
||
51 | */ |
||
52 | public function __construct($version, $serializeNulls, array $attributes, array $groups) |
||
59 | |||
60 | /** |
||
61 | * @inheritDoc |
||
62 | */ |
||
63 | public function createDeserializationContext() |
||
67 | |||
68 | /** |
||
69 | * @inheritDoc |
||
70 | */ |
||
71 | public function createSerializationContext() |
||
75 | |||
76 | /** |
||
77 | * Configures context according to configuration |
||
78 | * |
||
79 | * @param Context $context The context |
||
80 | * |
||
81 | * @return Context Given object |
||
82 | */ |
||
83 | private function configureContext(Context $context) |
||
97 | } |
||
98 |