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 = array(); |
||
36 | |||
37 | /** |
||
38 | * Serialization groups |
||
39 | * |
||
40 | * @var string[] |
||
41 | */ |
||
42 | private $groups = array(); |
||
43 | |||
44 | /** |
||
45 | * @param null|string $version |
||
46 | */ |
||
47 | public function setVersion($version) |
||
51 | |||
52 | /** |
||
53 | * @param bool $serializeNulls |
||
54 | */ |
||
55 | public function setSerializeNulls($serializeNulls) |
||
59 | |||
60 | /** |
||
61 | * @param array $attributes |
||
62 | */ |
||
63 | public function setAttributes(array $attributes) |
||
67 | |||
68 | /** |
||
69 | * @param string[] $groups |
||
70 | */ |
||
71 | public function setGroups(array $groups) |
||
75 | |||
76 | /** |
||
77 | * @inheritDoc |
||
78 | */ |
||
79 | public function createDeserializationContext() |
||
83 | |||
84 | /** |
||
85 | * @inheritDoc |
||
86 | */ |
||
87 | public function createSerializationContext() |
||
91 | |||
92 | /** |
||
93 | * Configures context according to configuration |
||
94 | * |
||
95 | * @param Context $context The context |
||
96 | * |
||
97 | * @return Context Given object |
||
98 | */ |
||
99 | private function configureContext(Context $context) |
||
116 | } |
||
117 |