|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author SignpostMarv |
|
4
|
|
|
*/ |
|
5
|
|
|
declare(strict_types=1); |
|
6
|
|
|
|
|
7
|
|
|
namespace SignpostMarv\DaftObject\SchemaOrg\CreativeWork; |
|
8
|
|
|
|
|
9
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\Article\NewsArticle; |
|
10
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork as Base; |
|
11
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits; |
|
12
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DataTypes\Date; |
|
13
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\MediaSubscription; |
|
14
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Quantity\Distance; |
|
15
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Quantity\Duration; |
|
16
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\QuantitativeValue; |
|
17
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Organization; |
|
18
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Place; |
|
19
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @property array<int, NewsArticle> $associatedArticle |
|
23
|
|
|
* @property array<int, string> $bitrate |
|
24
|
|
|
* @property array<int, string> $contentSize |
|
25
|
|
|
* @property array<int, string> $contentUrl |
|
26
|
|
|
* @property array<int, Duration> $duration |
|
27
|
|
|
* @property array<int, string> $embedUrl |
|
28
|
|
|
* @property array<int, Base> $encodesCreativeWork |
|
29
|
|
|
* @property array<int, Distance|QuantitativeValue> $height |
|
30
|
|
|
* @property array<int, string> $playerType |
|
31
|
|
|
* @property array<int, Organization> $productionCompany |
|
32
|
|
|
* @property array<int, Place> $regionsAllowed |
|
33
|
|
|
* @property array<int, bool|MediaSubscription> $requiresSubscription |
|
34
|
|
|
* @property array<int, Date> $uploadDate |
|
35
|
|
|
* @property array<int, Distance|QuantitativeValue> $width |
|
36
|
|
|
*/ |
|
37
|
|
|
class MediaObject extends Base |
|
38
|
|
|
{ |
|
39
|
|
|
use DaftObjectTraits\Duration; |
|
40
|
|
|
use DaftObjectTraits\HasHeights; |
|
41
|
|
|
|
|
42
|
|
|
const SCHEMA_ORG_TYPE = 'MediaObject'; |
|
43
|
|
|
|
|
44
|
|
|
const PROPERTIES = [ |
|
45
|
|
|
'associatedArticle', |
|
46
|
|
|
'bitrate', |
|
47
|
|
|
'contentSize', |
|
48
|
|
|
'contentUrl', |
|
49
|
|
|
'duration', |
|
50
|
|
|
'embedUrl', |
|
51
|
|
|
'encodesCreativeWork', |
|
52
|
|
|
'height', |
|
53
|
|
|
'playerType', |
|
54
|
|
|
'productionCompany', |
|
55
|
|
|
'regionsAllowed', |
|
56
|
|
|
'requiresSubscription', |
|
57
|
|
|
'uploadDate', |
|
58
|
|
|
'width', |
|
59
|
|
|
]; |
|
60
|
|
|
|
|
61
|
|
|
const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [ |
|
62
|
|
|
'associatedArticle' => [ |
|
63
|
|
|
NewsArticle::class, |
|
64
|
|
|
], |
|
65
|
|
|
'bitrate' => [ |
|
66
|
|
|
'string', |
|
67
|
|
|
], |
|
68
|
|
|
'contentSize' => [ |
|
69
|
|
|
'string', |
|
70
|
|
|
], |
|
71
|
|
|
'contentUrl' => [ |
|
72
|
|
|
'string', |
|
73
|
|
|
], |
|
74
|
|
|
'duration' => TypeUtilities::MULTI_TYPE_DICT__duration, |
|
75
|
|
|
'embedUrl' => [ |
|
76
|
|
|
'string', |
|
77
|
|
|
], |
|
78
|
|
|
'encodesCreativeWork' => [ |
|
79
|
|
|
Base::class, |
|
80
|
|
|
], |
|
81
|
|
|
'height' => TypeUtilities::MULTI_TYPE_DICT__height, |
|
82
|
|
|
'playerType' => [ |
|
83
|
|
|
'string', |
|
84
|
|
|
], |
|
85
|
|
|
'productionCompany' => [ |
|
86
|
|
|
Organization::class, |
|
87
|
|
|
], |
|
88
|
|
|
'regionsAllowed' => [ |
|
89
|
|
|
Place::class, |
|
90
|
|
|
], |
|
91
|
|
|
'requiresSubscription' => [ |
|
92
|
|
|
'boolean', |
|
93
|
|
|
MediaSubscription::class, |
|
94
|
|
|
], |
|
95
|
|
|
'uploadDate' => [ |
|
96
|
|
|
Date::class, |
|
97
|
|
|
], |
|
98
|
|
|
'width' => [ |
|
99
|
|
|
Distance::class, |
|
100
|
|
|
QuantitativeValue::class, |
|
101
|
|
|
], |
|
102
|
|
|
]; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return array<int, NewsArticle> |
|
106
|
|
|
*/ |
|
107
|
|
|
public function GetAssociatedArticle() : array |
|
108
|
|
|
{ |
|
109
|
|
|
/** |
|
110
|
|
|
* @var array<int, NewsArticle> |
|
111
|
|
|
*/ |
|
112
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
113
|
|
|
'associatedArticle', |
|
114
|
|
|
$this->RetrievePropertyValueFromData('associatedArticle'), |
|
115
|
|
|
static::class |
|
116
|
|
|
); |
|
117
|
268 |
|
|
|
118
|
268 |
|
return $out; |
|
119
|
268 |
|
} |
|
120
|
268 |
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @param array<int, NewsArticle> $value |
|
123
|
268 |
|
*/ |
|
124
|
|
|
public function SetAssociatedArticle(array $value) : void |
|
125
|
|
|
{ |
|
126
|
|
|
$this->NudgePropertyValue( |
|
127
|
|
|
'associatedArticle', |
|
128
|
|
|
$value |
|
129
|
9 |
|
); |
|
130
|
|
|
} |
|
131
|
9 |
|
|
|
132
|
9 |
|
/** |
|
133
|
9 |
|
* @return array<int, string> |
|
134
|
|
|
*/ |
|
135
|
9 |
|
public function GetBitrate() : array |
|
136
|
|
|
{ |
|
137
|
|
|
/** |
|
138
|
|
|
* @var array<int, string> |
|
139
|
|
|
*/ |
|
140
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
141
|
|
|
'bitrate', |
|
142
|
|
|
$this->RetrievePropertyValueFromData('bitrate'), |
|
143
|
|
|
static::class |
|
144
|
|
|
); |
|
145
|
268 |
|
|
|
146
|
268 |
|
return $out; |
|
147
|
268 |
|
} |
|
148
|
268 |
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param array<int, string> $value |
|
151
|
268 |
|
*/ |
|
152
|
|
|
public function SetBitrate(array $value) : void |
|
153
|
|
|
{ |
|
154
|
|
|
$this->NudgePropertyValue( |
|
155
|
|
|
'bitrate', |
|
156
|
|
|
$value, |
|
157
|
9 |
|
true |
|
158
|
|
|
); |
|
159
|
9 |
|
} |
|
160
|
9 |
|
|
|
161
|
9 |
|
/** |
|
162
|
9 |
|
* @return array<int, string> |
|
163
|
|
|
*/ |
|
164
|
9 |
|
public function GetContentSize() : array |
|
165
|
|
|
{ |
|
166
|
|
|
/** |
|
167
|
|
|
* @var array<int, string> |
|
168
|
|
|
*/ |
|
169
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
170
|
|
|
'contentSize', |
|
171
|
|
|
$this->RetrievePropertyValueFromData('contentSize'), |
|
172
|
|
|
static::class |
|
173
|
|
|
); |
|
174
|
268 |
|
|
|
175
|
268 |
|
return $out; |
|
176
|
268 |
|
} |
|
177
|
268 |
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @param array<int, string> $value |
|
180
|
268 |
|
*/ |
|
181
|
|
|
public function SetContentSize(array $value) : void |
|
182
|
|
|
{ |
|
183
|
|
|
$this->NudgePropertyValue( |
|
184
|
|
|
'contentSize', |
|
185
|
|
|
$value, |
|
186
|
9 |
|
true |
|
187
|
|
|
); |
|
188
|
9 |
|
} |
|
189
|
9 |
|
|
|
190
|
9 |
|
/** |
|
191
|
9 |
|
* @return array<int, string> |
|
192
|
|
|
*/ |
|
193
|
9 |
|
public function GetContentUrl() : array |
|
194
|
|
|
{ |
|
195
|
|
|
/** |
|
196
|
|
|
* @var array<int, string> |
|
197
|
|
|
*/ |
|
198
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
199
|
|
|
'contentUrl', |
|
200
|
|
|
$this->RetrievePropertyValueFromData('contentUrl'), |
|
201
|
|
|
static::class |
|
202
|
|
|
); |
|
203
|
268 |
|
|
|
204
|
268 |
|
return $out; |
|
205
|
268 |
|
} |
|
206
|
268 |
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* @param array<int, string> $value |
|
209
|
268 |
|
*/ |
|
210
|
|
|
public function SetContentUrl(array $value) : void |
|
211
|
|
|
{ |
|
212
|
|
|
$this->NudgePropertyValue( |
|
213
|
|
|
'contentUrl', |
|
214
|
|
|
$value, |
|
215
|
9 |
|
true |
|
216
|
|
|
); |
|
217
|
9 |
|
} |
|
218
|
9 |
|
|
|
219
|
9 |
|
/** |
|
220
|
9 |
|
* @return array<int, string> |
|
221
|
|
|
*/ |
|
222
|
9 |
|
public function GetEmbedUrl() : array |
|
223
|
|
|
{ |
|
224
|
|
|
/** |
|
225
|
|
|
* @var array<int, string> |
|
226
|
|
|
*/ |
|
227
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
228
|
|
|
'embedUrl', |
|
229
|
|
|
$this->RetrievePropertyValueFromData('embedUrl'), |
|
230
|
|
|
static::class |
|
231
|
|
|
); |
|
232
|
268 |
|
|
|
233
|
268 |
|
return $out; |
|
234
|
268 |
|
} |
|
235
|
268 |
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* @param array<int, string> $value |
|
238
|
268 |
|
*/ |
|
239
|
|
|
public function SetEmbedUrl(array $value) : void |
|
240
|
|
|
{ |
|
241
|
|
|
$this->NudgePropertyValue( |
|
242
|
|
|
'embedUrl', |
|
243
|
|
|
$value, |
|
244
|
9 |
|
true |
|
245
|
|
|
); |
|
246
|
9 |
|
} |
|
247
|
9 |
|
|
|
248
|
9 |
|
/** |
|
249
|
9 |
|
* @return array<int, Base> |
|
250
|
|
|
*/ |
|
251
|
9 |
|
public function GetEncodesCreativeWork() : array |
|
252
|
|
|
{ |
|
253
|
|
|
/** |
|
254
|
|
|
* @var array<int, Base> |
|
255
|
|
|
*/ |
|
256
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
257
|
|
|
'encodesCreativeWork', |
|
258
|
|
|
$this->RetrievePropertyValueFromData('encodesCreativeWork'), |
|
259
|
|
|
static::class |
|
260
|
|
|
); |
|
261
|
268 |
|
|
|
262
|
268 |
|
return $out; |
|
263
|
268 |
|
} |
|
264
|
268 |
|
|
|
265
|
|
|
/** |
|
266
|
|
|
* @param array<int, Base> $value |
|
267
|
268 |
|
*/ |
|
268
|
|
|
public function SetEncodesCreativeWork(array $value) : void |
|
269
|
|
|
{ |
|
270
|
|
|
$this->NudgePropertyValue( |
|
271
|
|
|
'encodesCreativeWork', |
|
272
|
|
|
$value |
|
273
|
9 |
|
); |
|
274
|
|
|
} |
|
275
|
9 |
|
|
|
276
|
9 |
|
/** |
|
277
|
9 |
|
* @return array<int, string> |
|
278
|
|
|
*/ |
|
279
|
9 |
|
public function GetPlayerType() : array |
|
280
|
|
|
{ |
|
281
|
|
|
/** |
|
282
|
|
|
* @var array<int, string> |
|
283
|
|
|
*/ |
|
284
|
273 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
285
|
|
|
'playerType', |
|
286
|
|
|
$this->RetrievePropertyValueFromData('playerType'), |
|
287
|
|
|
static::class |
|
288
|
|
|
); |
|
289
|
273 |
|
|
|
290
|
273 |
|
return $out; |
|
291
|
273 |
|
} |
|
292
|
273 |
|
|
|
293
|
|
|
/** |
|
294
|
|
|
* @param array<int, string> $value |
|
295
|
273 |
|
*/ |
|
296
|
|
|
public function SetPlayerType(array $value) : void |
|
297
|
|
|
{ |
|
298
|
|
|
$this->NudgePropertyValue( |
|
299
|
|
|
'playerType', |
|
300
|
|
|
$value, |
|
301
|
14 |
|
true |
|
302
|
|
|
); |
|
303
|
14 |
|
} |
|
304
|
14 |
|
|
|
305
|
14 |
|
/** |
|
306
|
14 |
|
* @return array<int, Organization> |
|
307
|
|
|
*/ |
|
308
|
14 |
|
public function GetProductionCompany() : array |
|
309
|
|
|
{ |
|
310
|
|
|
/** |
|
311
|
|
|
* @var array<int, Organization> |
|
312
|
|
|
*/ |
|
313
|
268 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
314
|
|
|
'productionCompany', |
|
315
|
|
|
$this->RetrievePropertyValueFromData('productionCompany'), |
|
316
|
|
|
static::class |
|
317
|
|
|
); |
|
318
|
268 |
|
|
|
319
|
268 |
|
return $out; |
|
320
|
268 |
|
} |
|
321
|
268 |
|
|
|
322
|
|
|
/** |
|
323
|
|
|
* @param array<int, Organization> $value |
|
324
|
268 |
|
*/ |
|
325
|
|
|
public function SetProductionCompany(array $value) : void |
|
326
|
|
|
{ |
|
327
|
|
|
$this->NudgePropertyValue( |
|
328
|
|
|
'productionCompany', |
|
329
|
|
|
$value |
|
330
|
9 |
|
); |
|
331
|
|
|
} |
|
332
|
9 |
|
|
|
333
|
9 |
|
/** |
|
334
|
9 |
|
* @return array<int, Place> |
|
335
|
9 |
|
*/ |
|
336
|
|
|
public function GetRegionsAllowed() : array |
|
337
|
9 |
|
{ |
|
338
|
|
|
/** |
|
339
|
|
|
* @var array<int, Place> |
|
340
|
|
|
*/ |
|
341
|
|
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
342
|
268 |
|
'regionsAllowed', |
|
343
|
|
|
$this->RetrievePropertyValueFromData('regionsAllowed'), |
|
344
|
|
|
static::class |
|
345
|
|
|
); |
|
346
|
|
|
|
|
347
|
268 |
|
return $out; |
|
348
|
268 |
|
} |
|
349
|
268 |
|
|
|
350
|
268 |
|
/** |
|
351
|
|
|
* @param array<int, Place> $value |
|
352
|
|
|
*/ |
|
353
|
268 |
|
public function SetRegionsAllowed(array $value) : void |
|
354
|
|
|
{ |
|
355
|
|
|
$this->NudgePropertyValue( |
|
356
|
|
|
'regionsAllowed', |
|
357
|
|
|
$value |
|
358
|
|
|
); |
|
359
|
9 |
|
} |
|
360
|
|
|
|
|
361
|
9 |
|
/** |
|
362
|
9 |
|
* @return array<int, bool|MediaSubscription> |
|
363
|
9 |
|
*/ |
|
364
|
|
|
public function GetRequiresSubscription() : array |
|
365
|
9 |
|
{ |
|
366
|
|
|
/** |
|
367
|
|
|
* @var array<int, bool|MediaSubscription> |
|
368
|
|
|
*/ |
|
369
|
|
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
370
|
268 |
|
'requiresSubscription', |
|
371
|
|
|
$this->RetrievePropertyValueFromData('requiresSubscription'), |
|
372
|
|
|
static::class |
|
373
|
|
|
); |
|
374
|
|
|
|
|
375
|
268 |
|
return $out; |
|
376
|
268 |
|
} |
|
377
|
268 |
|
|
|
378
|
268 |
|
/** |
|
379
|
|
|
* @param array<int, bool|MediaSubscription> $value |
|
380
|
|
|
*/ |
|
381
|
268 |
|
public function SetRequiresSubscription(array $value) : void |
|
382
|
|
|
{ |
|
383
|
|
|
$this->NudgePropertyValue( |
|
384
|
|
|
'requiresSubscription', |
|
385
|
|
|
$value |
|
386
|
|
|
); |
|
387
|
9 |
|
} |
|
388
|
|
|
|
|
389
|
9 |
|
/** |
|
390
|
9 |
|
* @return array<int, Date> |
|
391
|
9 |
|
*/ |
|
392
|
|
|
public function GetUploadDate() : array |
|
393
|
9 |
|
{ |
|
394
|
|
|
/** |
|
395
|
|
|
* @var array<int, Date> |
|
396
|
|
|
*/ |
|
397
|
|
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
398
|
268 |
|
'uploadDate', |
|
399
|
|
|
$this->RetrievePropertyValueFromData('uploadDate'), |
|
400
|
|
|
static::class |
|
401
|
|
|
); |
|
402
|
|
|
|
|
403
|
268 |
|
return $out; |
|
404
|
268 |
|
} |
|
405
|
268 |
|
|
|
406
|
268 |
|
/** |
|
407
|
|
|
* @param array<int, Date> $value |
|
408
|
|
|
*/ |
|
409
|
268 |
|
public function SetUploadDate(array $value) : void |
|
410
|
|
|
{ |
|
411
|
|
|
$this->NudgePropertyValue( |
|
412
|
|
|
'uploadDate', |
|
413
|
|
|
$value |
|
414
|
|
|
); |
|
415
|
9 |
|
} |
|
416
|
|
|
|
|
417
|
9 |
|
/** |
|
418
|
9 |
|
* @return array<int, Distance|QuantitativeValue> |
|
419
|
9 |
|
*/ |
|
420
|
|
|
public function GetWidth() : array |
|
421
|
9 |
|
{ |
|
422
|
|
|
/** |
|
423
|
|
|
* @var array<int, Distance|QuantitativeValue> |
|
424
|
|
|
*/ |
|
425
|
|
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
426
|
268 |
|
'width', |
|
427
|
|
|
$this->RetrievePropertyValueFromData('width'), |
|
428
|
|
|
static::class |
|
429
|
|
|
); |
|
430
|
|
|
|
|
431
|
268 |
|
return $out; |
|
432
|
268 |
|
} |
|
433
|
268 |
|
|
|
434
|
268 |
|
/** |
|
435
|
|
|
* @param array<int, Distance|QuantitativeValue> $value |
|
436
|
|
|
*/ |
|
437
|
268 |
|
public function SetWidth(array $value) : void |
|
438
|
|
|
{ |
|
439
|
|
|
$this->NudgePropertyValue( |
|
440
|
|
|
'width', |
|
441
|
|
|
$value |
|
442
|
|
|
); |
|
443
|
9 |
|
} |
|
444
|
|
|
} |
|
445
|
|
|
|