1 | <?php |
||
34 | class SerializerFactory { |
||
35 | |||
36 | public const OPTION_DEFAULT = 0; |
||
37 | /** @since 1.2.0 */ |
||
38 | public const OPTION_OBJECTS_FOR_MAPS = 1; |
||
39 | /** |
||
40 | * @since 1.7.0 |
||
41 | * @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH |
||
42 | */ |
||
43 | public const OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH = 2; |
||
44 | /** |
||
45 | * @since 1.7.0 |
||
46 | * @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH |
||
47 | */ |
||
48 | public const OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH = 4; |
||
49 | /** |
||
50 | * @since 1.7.0 |
||
51 | * @deprecated since 2.5 use OPTION_SERIALIZE_SNAKS_WITHOUT_HASH |
||
52 | */ |
||
53 | public const OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH = 8; |
||
54 | /** |
||
55 | * Omit hashes when serializing snaks. |
||
56 | * @since 2.5.0 |
||
57 | */ |
||
58 | public const OPTION_SERIALIZE_SNAKS_WITHOUT_HASH = 14; /* = |
||
59 | self::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH | |
||
60 | self::OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH | |
||
61 | self::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH; */ |
||
62 | |||
63 | /** |
||
64 | * @var int |
||
65 | */ |
||
66 | private $options; |
||
67 | |||
68 | /** |
||
69 | * @var Serializer |
||
70 | */ |
||
71 | private $dataValueSerializer; |
||
72 | |||
73 | /** |
||
74 | * @param Serializer $dataValueSerializer serializer for DataValue objects |
||
75 | * @param int $options set multiple with bitwise or |
||
76 | * |
||
77 | * @throws InvalidArgumentException |
||
78 | */ |
||
79 | 52 | public function __construct( Serializer $dataValueSerializer, $options = 0 ) { |
|
87 | |||
88 | /** |
||
89 | * @return bool |
||
90 | */ |
||
91 | 38 | private function shouldUseObjectsForMaps() { |
|
94 | |||
95 | /** |
||
96 | * @return bool |
||
97 | */ |
||
98 | 22 | private function shouldSerializeMainSnaksWithHash() { |
|
101 | |||
102 | /** |
||
103 | * @return bool |
||
104 | */ |
||
105 | 22 | private function shouldSerializeQualifierSnaksWithHash() { |
|
108 | |||
109 | /** |
||
110 | * @return bool |
||
111 | */ |
||
112 | 30 | private function shouldSerializeReferenceSnaksWithHash() { |
|
115 | |||
116 | /** |
||
117 | * @return DispatchableSerializer A serializer that can only serialize Item and Property |
||
118 | * objects, but no other entity types. In contexts with custom entity types other than items |
||
119 | * and properties this is not what you want. If in doubt, favor a custom |
||
120 | * `DispatchingSerializer` containing the exact entity serializers you need. |
||
121 | */ |
||
122 | 1 | public function newEntitySerializer() { |
|
128 | |||
129 | /** |
||
130 | * Returns a Serializer that can serialize Item objects. |
||
131 | * |
||
132 | * @since 2.1 |
||
133 | * |
||
134 | * @return DispatchableSerializer |
||
135 | */ |
||
136 | 8 | public function newItemSerializer() { |
|
145 | |||
146 | /** |
||
147 | * Returns a Serializer that can serialize Property objects. |
||
148 | * |
||
149 | * @since 2.1 |
||
150 | * |
||
151 | * @return DispatchableSerializer |
||
152 | */ |
||
153 | 3 | public function newPropertySerializer() { |
|
160 | |||
161 | /** |
||
162 | * Returns a Serializer that can serialize SiteLink objects. |
||
163 | * |
||
164 | * @return Serializer |
||
165 | */ |
||
166 | 12 | public function newSiteLinkSerializer() { |
|
169 | |||
170 | /** |
||
171 | * Returns a Serializer that can serialize StatementList objects. |
||
172 | * |
||
173 | * @since 1.4 |
||
174 | * |
||
175 | * @return Serializer |
||
176 | */ |
||
177 | 14 | public function newStatementListSerializer() { |
|
183 | |||
184 | /** |
||
185 | * Returns a Serializer that can serialize Statement objects. |
||
186 | * |
||
187 | * @since 1.4 |
||
188 | * |
||
189 | * @return DispatchableSerializer |
||
190 | */ |
||
191 | 22 | public function newStatementSerializer() { |
|
198 | |||
199 | /** |
||
200 | * Returns a Serializer that can serialize ReferenceList objects. |
||
201 | * |
||
202 | * @return Serializer |
||
203 | */ |
||
204 | 26 | public function newReferencesSerializer() { |
|
207 | |||
208 | /** |
||
209 | * Returns a Serializer that can serialize Reference objects. |
||
210 | * |
||
211 | * @return Serializer |
||
212 | */ |
||
213 | 30 | public function newReferenceSerializer() { |
|
220 | |||
221 | /** |
||
222 | * Returns a Serializer that can serialize SnakList objects. |
||
223 | * |
||
224 | * @param bool $serializeSnaksWithHash |
||
225 | * |
||
226 | * @since 1.4 |
||
227 | * |
||
228 | * @return Serializer |
||
229 | */ |
||
230 | 36 | public function newSnakListSerializer( $serializeSnaksWithHash = true ) { |
|
236 | |||
237 | /** |
||
238 | * Returns a Serializer that can serialize Snak objects. |
||
239 | * |
||
240 | * @param bool $serializeWithHash |
||
241 | * |
||
242 | * @return Serializer |
||
243 | */ |
||
244 | 43 | public function newSnakSerializer( $serializeWithHash = true ) { |
|
247 | |||
248 | /** |
||
249 | * Returns a Serializer that can serialize TypedSnak objects. |
||
250 | * |
||
251 | * @param bool $serializeWithHash |
||
252 | * |
||
253 | * @since 1.3 |
||
254 | * |
||
255 | * @return Serializer |
||
256 | */ |
||
257 | 1 | public function newTypedSnakSerializer( $serializeWithHash = true ) { |
|
260 | |||
261 | /** |
||
262 | * Returns a Serializer that can serialize Term objects. |
||
263 | * |
||
264 | * @since 1.5 |
||
265 | * |
||
266 | * @return Serializer |
||
267 | */ |
||
268 | 12 | public function newTermSerializer() { |
|
271 | |||
272 | /** |
||
273 | * Returns a Serializer that can serialize TermList objects. |
||
274 | * |
||
275 | * @since 1.5 |
||
276 | * |
||
277 | * @return Serializer |
||
278 | */ |
||
279 | 11 | public function newTermListSerializer() { |
|
282 | |||
283 | /** |
||
284 | * Returns a Serializer that can serialize AliasGroup objects. |
||
285 | * |
||
286 | * @since 1.6 |
||
287 | * |
||
288 | * @return Serializer |
||
289 | */ |
||
290 | 12 | public function newAliasGroupSerializer() { |
|
293 | |||
294 | /** |
||
295 | * Returns a Serializer that can serialize AliasGroupList objects. |
||
296 | * |
||
297 | * @since 1.5 |
||
298 | * |
||
299 | * @return Serializer |
||
300 | */ |
||
301 | 11 | public function newAliasGroupListSerializer() { |
|
307 | |||
308 | } |
||
309 |
This class constant has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.