1 | <?php |
||
34 | class SerializerFactory { |
||
35 | |||
36 | const OPTION_DEFAULT = 0; |
||
37 | /** @since 1.2.0 */ |
||
38 | const OPTION_OBJECTS_FOR_MAPS = 1; |
||
39 | /** @since 1.7.0 */ |
||
40 | const OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH = 2; |
||
41 | const OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH = 4; |
||
42 | const OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH = 8; |
||
43 | |||
44 | /** |
||
45 | * @var int |
||
46 | */ |
||
47 | private $options; |
||
48 | |||
49 | /** |
||
50 | * @var Serializer |
||
51 | */ |
||
52 | private $dataValueSerializer; |
||
53 | |||
54 | /** |
||
55 | * @var DispatchableSerializer[] |
||
56 | */ |
||
57 | private $additionalEntitySerializers; |
||
58 | |||
59 | /** |
||
60 | * @param Serializer $dataValueSerializer serializer for DataValue objects |
||
61 | * @param int $options set multiple with bitwise or |
||
62 | * @param DispatchableSerializer[] $additionalEntitySerializers |
||
63 | * |
||
64 | * @throws InvalidArgumentException |
||
65 | */ |
||
66 | public function __construct( |
||
79 | |||
80 | /** |
||
81 | * @return bool |
||
82 | */ |
||
83 | private function shouldUseObjectsForMaps() { |
||
86 | |||
87 | /** |
||
88 | * @return bool |
||
89 | */ |
||
90 | private function shouldSerializeMainSnaksWithHash() { |
||
93 | |||
94 | /** |
||
95 | * @return bool |
||
96 | */ |
||
97 | private function shouldSerializeQualifierSnaksWithHash() { |
||
100 | |||
101 | /** |
||
102 | * @return bool |
||
103 | */ |
||
104 | private function shouldSerializeReferenceSnaksWithHash() { |
||
107 | |||
108 | /** |
||
109 | * Returns a Serializer that can serialize Entity objects. |
||
110 | * |
||
111 | * @return Serializer |
||
112 | */ |
||
113 | public function newEntitySerializer() { |
||
124 | |||
125 | /** |
||
126 | * @return DispatchableSerializer |
||
127 | */ |
||
128 | private function newItemSerializer() { |
||
137 | |||
138 | /** |
||
139 | * @return DispatchableSerializer |
||
140 | */ |
||
141 | private function newPropertySerializer() { |
||
148 | |||
149 | /** |
||
150 | * Returns a Serializer that can serialize SiteLink objects. |
||
151 | * |
||
152 | * @return Serializer |
||
153 | */ |
||
154 | public function newSiteLinkSerializer() { |
||
157 | |||
158 | /** |
||
159 | * Returns a Serializer that can serialize StatementList objects. |
||
160 | * |
||
161 | * @since 1.4 |
||
162 | * |
||
163 | * @return Serializer |
||
164 | */ |
||
165 | public function newStatementListSerializer() { |
||
171 | |||
172 | /** |
||
173 | * Returns a Serializer that can serialize Statement objects. |
||
174 | * |
||
175 | * @since 1.4 |
||
176 | * |
||
177 | * @return Serializer |
||
178 | */ |
||
179 | public function newStatementSerializer() { |
||
186 | |||
187 | /** |
||
188 | * Returns a Serializer that can serialize ReferenceList objects. |
||
189 | * |
||
190 | * @return Serializer |
||
191 | */ |
||
192 | public function newReferencesSerializer() { |
||
195 | |||
196 | /** |
||
197 | * Returns a Serializer that can serialize Reference objects. |
||
198 | * |
||
199 | * @return Serializer |
||
200 | */ |
||
201 | public function newReferenceSerializer() { |
||
208 | |||
209 | /** |
||
210 | * Returns a Serializer that can serialize SnakList objects. |
||
211 | * |
||
212 | * @param bool $serializeSnaksWithHash |
||
213 | * |
||
214 | * @since 1.4 |
||
215 | * |
||
216 | * @return Serializer |
||
217 | */ |
||
218 | public function newSnakListSerializer( $serializeSnaksWithHash = true ) { |
||
224 | |||
225 | /** |
||
226 | * Returns a Serializer that can serialize Snak objects. |
||
227 | * |
||
228 | * @param bool $serializeWithHash |
||
229 | * |
||
230 | * @return Serializer |
||
231 | */ |
||
232 | public function newSnakSerializer( $serializeWithHash = true ) { |
||
238 | |||
239 | /** |
||
240 | * Returns a Serializer that can serialize TypedSnak objects. |
||
241 | * |
||
242 | * @param bool $serializeWithHash |
||
243 | * |
||
244 | * @since 1.3 |
||
245 | * |
||
246 | * @return Serializer |
||
247 | */ |
||
248 | public function newTypedSnakSerializer( $serializeWithHash = true ) { |
||
251 | |||
252 | /** |
||
253 | * Returns a Serializer that can serialize Term objects. |
||
254 | * |
||
255 | * @since 1.5 |
||
256 | * |
||
257 | * @return Serializer |
||
258 | */ |
||
259 | public function newTermSerializer() { |
||
262 | |||
263 | /** |
||
264 | * Returns a Serializer that can serialize TermList objects. |
||
265 | * |
||
266 | * @since 1.5 |
||
267 | * |
||
268 | * @return Serializer |
||
269 | */ |
||
270 | public function newTermListSerializer() { |
||
273 | |||
274 | /** |
||
275 | * Returns a Serializer that can serialize AliasGroup objects. |
||
276 | * |
||
277 | * @since 1.6 |
||
278 | * |
||
279 | * @return Serializer |
||
280 | */ |
||
281 | public function newAliasGroupSerializer() { |
||
284 | |||
285 | /** |
||
286 | * Returns a Serializer that can serialize AliasGroupList objects. |
||
287 | * |
||
288 | * @since 1.5 |
||
289 | * |
||
290 | * @return Serializer |
||
291 | */ |
||
292 | public function newAliasGroupListSerializer() { |
||
295 | |||
296 | } |
||
297 |