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 | * Flag if we should enable the max depth exclusion strategy |
||
32 | * |
||
33 | * @var bool |
||
34 | */ |
||
35 | private $enableMaxDepthChecks = false; |
||
36 | |||
37 | /** |
||
38 | * Key-value pairs with custom attributes |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | private $attributes = array(); |
||
43 | |||
44 | /** |
||
45 | * Serialization groups |
||
46 | * |
||
47 | * @var string[] |
||
48 | */ |
||
49 | private $groups = array(); |
||
50 | |||
51 | /** |
||
52 | * @param null|string $version |
||
53 | */ |
||
54 | public function setVersion($version) |
||
58 | |||
59 | /** |
||
60 | * @param bool $serializeNulls |
||
61 | */ |
||
62 | public function setSerializeNulls($serializeNulls) |
||
66 | |||
67 | public function enableMaxDepthChecks() |
||
71 | |||
72 | /** |
||
73 | * @param array $attributes |
||
74 | */ |
||
75 | public function setAttributes(array $attributes) |
||
79 | |||
80 | /** |
||
81 | * @param string[] $groups |
||
82 | */ |
||
83 | public function setGroups(array $groups) |
||
87 | |||
88 | /** |
||
89 | * @inheritDoc |
||
90 | */ |
||
91 | public function createDeserializationContext() |
||
95 | |||
96 | /** |
||
97 | * @inheritDoc |
||
98 | */ |
||
99 | public function createSerializationContext() |
||
103 | |||
104 | /** |
||
105 | * Configures context according to configuration |
||
106 | * |
||
107 | * @param Context $context The context |
||
108 | * |
||
109 | * @return Context Given object |
||
110 | */ |
||
111 | private function configureContext(Context $context) |
||
133 | } |
||
134 |