1 | <?php |
||
35 | class SerializerFactory { |
||
36 | |||
37 | const OPTION_DEFAULT = 0; |
||
38 | /** @since 1.2.0 */ |
||
39 | const OPTION_OBJECTS_FOR_MAPS = 1; |
||
40 | /** @since 1.7.0 */ |
||
41 | const OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH = 2; |
||
42 | const OPTION_SERIALIZE_QUALIFIER_SNAKS_WITHOUT_HASH = 4; |
||
43 | const OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH = 8; |
||
44 | |||
45 | /** |
||
46 | * @var DispatchableSerializer[]|callable[] |
||
47 | */ |
||
48 | private $entitySerializers; |
||
49 | |||
50 | /** |
||
51 | * @var Serializer |
||
52 | */ |
||
53 | private $dataValueSerializer; |
||
54 | |||
55 | /** |
||
56 | * @var int |
||
57 | */ |
||
58 | private $options; |
||
59 | |||
60 | /** |
||
61 | * @since 2.3 |
||
62 | * |
||
63 | * @param DispatchableSerializer[]|callable[] $entitySerializers A list of either |
||
64 | * DispatchableSerializer objects that are able to serialize Entities, or callbacks that return |
||
65 | * such objects. |
||
66 | * @param Serializer $dataValueSerializer serializer for DataValue objects |
||
67 | * @param int $options set multiple with bitwise or |
||
68 | * |
||
69 | * @throws InvalidArgumentException |
||
70 | */ |
||
71 | public function __construct( |
||
84 | |||
85 | /** |
||
86 | * @return bool |
||
87 | */ |
||
88 | private function shouldUseObjectsForMaps() { |
||
91 | |||
92 | /** |
||
93 | * @return bool |
||
94 | */ |
||
95 | private function shouldSerializeMainSnaksWithHash() { |
||
98 | |||
99 | /** |
||
100 | * @return bool |
||
101 | */ |
||
102 | private function shouldSerializeQualifierSnaksWithHash() { |
||
105 | |||
106 | /** |
||
107 | * @return bool |
||
108 | */ |
||
109 | private function shouldSerializeReferenceSnaksWithHash() { |
||
112 | |||
113 | /** |
||
114 | * @throws IllegalValueException |
||
115 | * @return Serializer A dispatching serializer that can serialize whatever the give serializers |
||
116 | * support. There is no default support for Items or Properties. |
||
117 | */ |
||
118 | public function newEntitySerializer() { |
||
133 | |||
134 | /** |
||
135 | * Returns a Serializer that can serialize Item objects. |
||
136 | * |
||
137 | * @since 2.1 |
||
138 | * |
||
139 | * @return Serializer |
||
140 | */ |
||
141 | public function newItemSerializer() { |
||
150 | |||
151 | /** |
||
152 | * Returns a Serializer that can serialize Property objects. |
||
153 | * |
||
154 | * @since 2.1 |
||
155 | * |
||
156 | * @return Serializer |
||
157 | */ |
||
158 | public function newPropertySerializer() { |
||
165 | |||
166 | /** |
||
167 | * Returns a Serializer that can serialize SiteLink objects. |
||
168 | * |
||
169 | * @return Serializer |
||
170 | */ |
||
171 | public function newSiteLinkSerializer() { |
||
174 | |||
175 | /** |
||
176 | * Returns a Serializer that can serialize StatementList objects. |
||
177 | * |
||
178 | * @since 1.4 |
||
179 | * |
||
180 | * @return Serializer |
||
181 | */ |
||
182 | public function newStatementListSerializer() { |
||
188 | |||
189 | /** |
||
190 | * Returns a Serializer that can serialize Statement objects. |
||
191 | * |
||
192 | * @since 1.4 |
||
193 | * |
||
194 | * @return Serializer |
||
195 | */ |
||
196 | public function newStatementSerializer() { |
||
203 | |||
204 | /** |
||
205 | * Returns a Serializer that can serialize ReferenceList objects. |
||
206 | * |
||
207 | * @return Serializer |
||
208 | */ |
||
209 | public function newReferencesSerializer() { |
||
212 | |||
213 | /** |
||
214 | * Returns a Serializer that can serialize Reference objects. |
||
215 | * |
||
216 | * @return Serializer |
||
217 | */ |
||
218 | public function newReferenceSerializer() { |
||
225 | |||
226 | /** |
||
227 | * Returns a Serializer that can serialize SnakList objects. |
||
228 | * |
||
229 | * @param bool $serializeSnaksWithHash |
||
230 | * |
||
231 | * @since 1.4 |
||
232 | * |
||
233 | * @return Serializer |
||
234 | */ |
||
235 | public function newSnakListSerializer( $serializeSnaksWithHash = true ) { |
||
241 | |||
242 | /** |
||
243 | * Returns a Serializer that can serialize Snak objects. |
||
244 | * |
||
245 | * @param bool $serializeWithHash |
||
246 | * |
||
247 | * @return Serializer |
||
248 | */ |
||
249 | public function newSnakSerializer( $serializeWithHash = true ) { |
||
255 | |||
256 | /** |
||
257 | * Returns a Serializer that can serialize TypedSnak objects. |
||
258 | * |
||
259 | * @param bool $serializeWithHash |
||
260 | * |
||
261 | * @since 1.3 |
||
262 | * |
||
263 | * @return Serializer |
||
264 | */ |
||
265 | public function newTypedSnakSerializer( $serializeWithHash = true ) { |
||
268 | |||
269 | /** |
||
270 | * Returns a Serializer that can serialize Term objects. |
||
271 | * |
||
272 | * @since 1.5 |
||
273 | * |
||
274 | * @return Serializer |
||
275 | */ |
||
276 | public function newTermSerializer() { |
||
279 | |||
280 | /** |
||
281 | * Returns a Serializer that can serialize TermList objects. |
||
282 | * |
||
283 | * @since 1.5 |
||
284 | * |
||
285 | * @return Serializer |
||
286 | */ |
||
287 | public function newTermListSerializer() { |
||
290 | |||
291 | /** |
||
292 | * Returns a Serializer that can serialize AliasGroup objects. |
||
293 | * |
||
294 | * @since 1.6 |
||
295 | * |
||
296 | * @return Serializer |
||
297 | */ |
||
298 | public function newAliasGroupSerializer() { |
||
301 | |||
302 | /** |
||
303 | * Returns a Serializer that can serialize AliasGroupList objects. |
||
304 | * |
||
305 | * @since 1.5 |
||
306 | * |
||
307 | * @return Serializer |
||
308 | */ |
||
309 | public function newAliasGroupListSerializer() { |
||
312 | |||
313 | } |
||
314 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..