Passed
Push — master ( 3789b3...a7ef54 )
by SignpostMarv
13:07
created

MediaObject::SetAssociatedArticle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 268
    public function GetAssociatedArticle() : array
108
    {
109
        /**
110
        * @var array<int, NewsArticle>
111
        */
112 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
113 268
            'associatedArticle',
114 268
            $this->RetrievePropertyValueFromData('associatedArticle'),
115 268
            static::class
116
        );
117
118 268
        return $out;
119
    }
120
121
    /**
122
    * @param array<int, NewsArticle> $value
123
    */
124 9
    public function SetAssociatedArticle(array $value) : void
125
    {
126 9
        $this->NudgePropertyValue(
127 9
            'associatedArticle',
128 9
            $value
129
        );
130 9
    }
131
132
    /**
133
    * @return array<int, string>
134
    */
135 268
    public function GetBitrate() : array
136
    {
137
        /**
138
        * @var array<int, string>
139
        */
140 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
141 268
            'bitrate',
142 268
            $this->RetrievePropertyValueFromData('bitrate'),
143 268
            static::class
144
        );
145
146 268
        return $out;
147
    }
148
149
    /**
150
    * @param array<int, string> $value
151
    */
152 9
    public function SetBitrate(array $value) : void
153
    {
154 9
        $this->NudgePropertyValue(
155 9
            'bitrate',
156 9
            $value,
157 9
            true
158
        );
159 9
    }
160
161
    /**
162
    * @return array<int, string>
163
    */
164 268
    public function GetContentSize() : array
165
    {
166
        /**
167
        * @var array<int, string>
168
        */
169 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
170 268
            'contentSize',
171 268
            $this->RetrievePropertyValueFromData('contentSize'),
172 268
            static::class
173
        );
174
175 268
        return $out;
176
    }
177
178
    /**
179
    * @param array<int, string> $value
180
    */
181 9
    public function SetContentSize(array $value) : void
182
    {
183 9
        $this->NudgePropertyValue(
184 9
            'contentSize',
185 9
            $value,
186 9
            true
187
        );
188 9
    }
189
190
    /**
191
    * @return array<int, string>
192
    */
193 268
    public function GetContentUrl() : array
194
    {
195
        /**
196
        * @var array<int, string>
197
        */
198 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
199 268
            'contentUrl',
200 268
            $this->RetrievePropertyValueFromData('contentUrl'),
201 268
            static::class
202
        );
203
204 268
        return $out;
205
    }
206
207
    /**
208
    * @param array<int, string> $value
209
    */
210 9
    public function SetContentUrl(array $value) : void
211
    {
212 9
        $this->NudgePropertyValue(
213 9
            'contentUrl',
214 9
            $value,
215 9
            true
216
        );
217 9
    }
218
219
    /**
220
    * @return array<int, string>
221
    */
222 268
    public function GetEmbedUrl() : array
223
    {
224
        /**
225
        * @var array<int, string>
226
        */
227 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
228 268
            'embedUrl',
229 268
            $this->RetrievePropertyValueFromData('embedUrl'),
230 268
            static::class
231
        );
232
233 268
        return $out;
234
    }
235
236
    /**
237
    * @param array<int, string> $value
238
    */
239 9
    public function SetEmbedUrl(array $value) : void
240
    {
241 9
        $this->NudgePropertyValue(
242 9
            'embedUrl',
243 9
            $value,
244 9
            true
245
        );
246 9
    }
247
248
    /**
249
    * @return array<int, Base>
250
    */
251 268
    public function GetEncodesCreativeWork() : array
252
    {
253
        /**
254
        * @var array<int, Base>
255
        */
256 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
257 268
            'encodesCreativeWork',
258 268
            $this->RetrievePropertyValueFromData('encodesCreativeWork'),
259 268
            static::class
260
        );
261
262 268
        return $out;
263
    }
264
265
    /**
266
    * @param array<int, Base> $value
267
    */
268 9
    public function SetEncodesCreativeWork(array $value) : void
269
    {
270 9
        $this->NudgePropertyValue(
271 9
            'encodesCreativeWork',
272 9
            $value
273
        );
274 9
    }
275
276
    /**
277
    * @return array<int, string>
278
    */
279 268
    public function GetPlayerType() : array
280
    {
281
        /**
282
        * @var array<int, string>
283
        */
284 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
285 268
            'playerType',
286 268
            $this->RetrievePropertyValueFromData('playerType'),
287 268
            static::class
288
        );
289
290 268
        return $out;
291
    }
292
293
    /**
294
    * @param array<int, string> $value
295
    */
296 9
    public function SetPlayerType(array $value) : void
297
    {
298 9
        $this->NudgePropertyValue(
299 9
            'playerType',
300 9
            $value,
301 9
            true
302
        );
303 9
    }
304
305
    /**
306
    * @return array<int, Organization>
307
    */
308 268
    public function GetProductionCompany() : array
309
    {
310
        /**
311
        * @var array<int, Organization>
312
        */
313 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
314 268
            'productionCompany',
315 268
            $this->RetrievePropertyValueFromData('productionCompany'),
316 268
            static::class
317
        );
318
319 268
        return $out;
320
    }
321
322
    /**
323
    * @param array<int, Organization> $value
324
    */
325 9
    public function SetProductionCompany(array $value) : void
326
    {
327 9
        $this->NudgePropertyValue(
328 9
            'productionCompany',
329 9
            $value
330
        );
331 9
    }
332
333
    /**
334
    * @return array<int, Place>
335
    */
336 268
    public function GetRegionsAllowed() : array
337
    {
338
        /**
339
        * @var array<int, Place>
340
        */
341 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
342 268
            'regionsAllowed',
343 268
            $this->RetrievePropertyValueFromData('regionsAllowed'),
344 268
            static::class
345
        );
346
347 268
        return $out;
348
    }
349
350
    /**
351
    * @param array<int, Place> $value
352
    */
353 9
    public function SetRegionsAllowed(array $value) : void
354
    {
355 9
        $this->NudgePropertyValue(
356 9
            'regionsAllowed',
357 9
            $value
358
        );
359 9
    }
360
361
    /**
362
    * @return array<int, bool|MediaSubscription>
363
    */
364 268
    public function GetRequiresSubscription() : array
365
    {
366
        /**
367
        * @var array<int, bool|MediaSubscription>
368
        */
369 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
370 268
            'requiresSubscription',
371 268
            $this->RetrievePropertyValueFromData('requiresSubscription'),
372 268
            static::class
373
        );
374
375 268
        return $out;
376
    }
377
378
    /**
379
    * @param array<int, bool|MediaSubscription> $value
380
    */
381 9
    public function SetRequiresSubscription(array $value) : void
382
    {
383 9
        $this->NudgePropertyValue(
384 9
            'requiresSubscription',
385 9
            $value
386
        );
387 9
    }
388
389
    /**
390
    * @return array<int, Date>
391
    */
392 268
    public function GetUploadDate() : array
393
    {
394
        /**
395
        * @var array<int, Date>
396
        */
397 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
398 268
            'uploadDate',
399 268
            $this->RetrievePropertyValueFromData('uploadDate'),
400 268
            static::class
401
        );
402
403 268
        return $out;
404
    }
405
406
    /**
407
    * @param array<int, Date> $value
408
    */
409 9
    public function SetUploadDate(array $value) : void
410
    {
411 9
        $this->NudgePropertyValue(
412 9
            'uploadDate',
413 9
            $value
414
        );
415 9
    }
416
417
    /**
418
    * @return array<int, Distance|QuantitativeValue>
419
    */
420 268
    public function GetWidth() : array
421
    {
422
        /**
423
        * @var array<int, Distance|QuantitativeValue>
424
        */
425 268
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
426 268
            'width',
427 268
            $this->RetrievePropertyValueFromData('width'),
428 268
            static::class
429
        );
430
431 268
        return $out;
432
    }
433
434
    /**
435
    * @param array<int, Distance|QuantitativeValue> $value
436
    */
437 9
    public function SetWidth(array $value) : void
438
    {
439 9
        $this->NudgePropertyValue(
440 9
            'width',
441 9
            $value
442
        );
443 9
    }
444
}
445