Passed
Push — master ( f71194...439e24 )
by SignpostMarv
11:18
created

Place::SetPublicAccess()   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;
8
9
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\Map;
10
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\MediaObject\ImageObject;
11
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\Photograph;
12
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\Review;
13
use SignpostMarv\DaftObject\SchemaOrg\Intangible\GeospatialGeometry;
14
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Rating\AggregateRating;
15
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\ContactPoint\PostalAddress;
16
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\OpeningHoursSpecification;
17
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\PropertyValue;
18
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\PropertyValue\LocationFeatureSpecification;
19
20
/**
21
* @property array<int, PropertyValue> $additionalProperty
22
* @property array<int, string|PostalAddress> $address
23
* @property array<int, AggregateRating> $aggregateRating
24
* @property array<int, LocationFeatureSpecification> $amenityFeature
25
* @property array<int, string> $branchCode
26
* @property array<int, Place> $containedInPlace
27
* @property array<int, Place> $containsPlace
28
* @property array<int, Event> $event
29
* @property array<int, string|Map> $hasMap
30
* @property array<int, GeoCoordinates|GeoShape> $geo
31
* @property array<int, GeospatialGeometry|Place> $geospatiallyContains
32
* @property array<int, GeospatialGeometry|Place> $geospatiallyCoveredBy
33
* @property array<int, GeospatialGeometry|Place> $geospatiallyCovers
34
* @property array<int, GeospatialGeometry|Place> $geospatiallyCrosses
35
* @property array<int, GeospatialGeometry|Place> $geospatiallyDisjoint
36
* @property array<int, GeospatialGeometry|Place> $geospatiallyEquals
37
* @property array<int, GeospatialGeometry|Place> $geospatiallyIntersects
38
* @property array<int, GeospatialGeometry|Place> $geospatiallyOverlaps
39
* @property array<int, GeospatialGeometry|Place> $geospatiallyTouches
40
* @property array<int, GeospatialGeometry|Place> $geospatiallyWithin
41
* @property array<int, string> $globalLocationNumber
42
* @property array<int, bool> $isAccessibleForFree
43
* @property array<int, string> $isicV4
44
* @property array<int, ImageObject> $logo
45
* @property array<int, int> $maximumAttendeeCapacity
46
* @property array<int, OpeningHoursSpecification> $openingHoursSpecification
47
* @property array<int, ImageObject|Photograph> $photo
48
* @property array<int, bool> $publicAccess
49
* @property array<int, Review> $review
50
* @property array<int, bool> $smokingAllowed
51
* @property array<int, OpeningHoursSpecification> $specialOpeningHoursSpecification
52
* @property array<int, string> $telephone
53
*/
54
class Place extends Thing
55
{
56
    use DaftObjectTraits\TraitAdditionalProperty;
57
    use DaftObjectTraits\HasAddress;
58
    use DaftObjectTraits\HasAggregateRating;
59
    use DaftObjectTraits\HasEvent;
60
    use DaftObjectTraits\HasFaxNumber;
61
    use DaftObjectTraits\HasGeospatialGeometry;
62
    use DaftObjectTraits\HasGlobalLocationNumber;
63
    use DaftObjectTraits\HasIsAccessibleForFree;
64
    use DaftObjectTraits\HasIsicV4;
65
    use DaftObjectTraits\HasLogo;
66
    use DaftObjectTraits\HasReview;
67
    use DaftObjectTraits\HasTelephone;
68
69
    const SCHEMA_ORG_TYPE = 'Place';
70
71
    const PROPERTIES = [
72
        'additionalProperty',
73
        'address',
74
        'aggregateRating',
75
        'amenityFeature',
76
        'branchCode',
77
        'containedInPlace',
78
        'containsPlace',
79
        'event',
80
        'faxNumber',
81
        'geo',
82
        'geospatiallyContains',
83
        'geospatiallyCoveredBy',
84
        'geospatiallyCovers',
85
        'geospatiallyCrosses',
86
        'geospatiallyDisjoint',
87
        'geospatiallyEquals',
88
        'geospatiallyIntersects',
89
        'geospatiallyOverlaps',
90
        'geospatiallyTouches',
91
        'geospatiallyWithin',
92
        'globalLocationNumber',
93
        'hasMap',
94
        'isAccessibleForFree',
95
        'isicV4',
96
        'logo',
97
        'maximumAttendeeCapacity',
98
        'openingHoursSpecification',
99
        'photo',
100
        'publicAccess',
101
        'review',
102
        'smokingAllowed',
103
        'specialOpeningHoursSpecification',
104
        'telephone',
105
    ];
106
107
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
108
        'additionalProperty' => [
109
            PropertyValue::class,
110
        ],
111
        'address' => [
112
            'string',
113
            PostalAddress::class,
114
        ],
115
        'aggregateRating' => [
116
            AggregateRating::class,
117
        ],
118
        'amenityFeature' => [
119
            LocationFeatureSpecification::class,
120
        ],
121
        'branchCode' => [
122
            'string',
123
        ],
124
        'containedInPlace' => [
125
            Place::class,
126
        ],
127
        'containsPlace' => [
128
            Place::class,
129
        ],
130
        'event' => [
131
            Event::class,
132
        ],
133
        'hasMap' => [
134
            'string',
135
            Map::class,
136
        ],
137
        'geo' => [
138
            GeoCoordinates::class,
139
            GeoShape::class,
140
        ],
141
        'geospatiallyContains' => [
142
            GeospatialGeometry::class,
143
            Place::class,
144
        ],
145
        'geospatiallyCoveredBy' => [
146
            GeospatialGeometry::class,
147
            Place::class,
148
        ],
149
        'geospatiallyCovers' => [
150
            GeospatialGeometry::class,
151
            Place::class,
152
        ],
153
        'geospatiallyCrosses' => [
154
            GeospatialGeometry::class,
155
            Place::class,
156
        ],
157
        'geospatiallyDisjoint' => [
158
            GeospatialGeometry::class,
159
            Place::class,
160
        ],
161
        'geospatiallyEquals' => [
162
            GeospatialGeometry::class,
163
            Place::class,
164
        ],
165
        'geospatiallyIntersects' => [
166
            GeospatialGeometry::class,
167
            Place::class,
168
        ],
169
        'geospatiallyOverlaps' => [
170
            GeospatialGeometry::class,
171
            Place::class,
172
        ],
173
        'geospatiallyTouches' => [
174
            GeospatialGeometry::class,
175
            Place::class,
176
        ],
177
        'geospatiallyWithin' => [
178
            GeospatialGeometry::class,
179
            Place::class,
180
        ],
181
        'globalLocationNumber' => [
182
            'string',
183
        ],
184
        'isAccessibleForFree' => [
185
            'boolean',
186
        ],
187
        'isicV4' => [
188
            'string',
189
        ],
190
        'logo' => [
191
            ImageObject::class,
192
        ],
193
        'maximumAttendeeCapacity' => [
194
            'integer',
195
        ],
196
        'openingHoursSpecification' => [
197
            OpeningHoursSpecification::class,
198
        ],
199
        'photo' => [
200
            ImageObject::class,
201
            Photograph::class,
202
        ],
203
        'publicAccess' => [
204
            'boolean',
205
        ],
206
        'review' => [
207
            Review::class,
208
        ],
209
        'smokingAllowed' => [
210
            'boolean',
211
        ],
212
        'specialOpeningHoursSpecification' => [
213
            OpeningHoursSpecification::class,
214
        ],
215
        'telephone' => [
216
            'string',
217
        ],
218
    ];
219
220
    /**
221
    * @return array<int, LocationFeatureSpecification>
222
    */
223 71
    public function GetAmenityFeature() : array
224
    {
225
        /**
226
        * @var array<int, LocationFeatureSpecification>
227
        */
228 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
229 71
            'amenityFeature',
230 71
            $this->RetrievePropertyValueFromData('amenityFeature'),
231 71
            static::class
232
        );
233
234 71
        return $out;
235
    }
236
237
    /**
238
    * @param array<int, LocationFeatureSpecification> $value
239
    */
240 3
    public function SetAmenityFeature(array $value) : void
241
    {
242 3
        $this->NudgePropertyWithUniqueValuesOfThings(
243 3
            'amenityFeature',
244 3
            __METHOD__,
245 3
            $value,
246 3
            LocationFeatureSpecification::class
247
        );
248 3
    }
249
250
    /**
251
    * @return array<int, string>
252
    */
253 71
    public function GetBranchCode() : array
254
    {
255
        /**
256
        * @var array<int, string>
257
        */
258 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
259 71
            'branchCode',
260 71
            $this->RetrievePropertyValueFromData('branchCode'),
261 71
            static::class
262
        );
263
264 71
        return $out;
265
    }
266
267
    /**
268
    * @param array<int, string> $value
269
    */
270 3
    public function SetBranchCode(array $value) : void
271
    {
272 3
        $this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString(
273 3
            'branchCode',
274 3
            __METHOD__,
275 3
            $value
276
        );
277 3
    }
278
279
    /**
280
    * @return array<int, Place>
281
    */
282 71
    public function GetContainedInPlace() : array
283
    {
284
        /**
285
        * @var array<int, Place>
286
        */
287 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
288 71
            'containedInPlace',
289 71
            $this->RetrievePropertyValueFromData('containedInPlace'),
290 71
            static::class
291
        );
292
293 71
        return $out;
294
    }
295
296
    /**
297
    * @param array<int, Place> $value
298
    */
299 3
    public function SetContainedInPlace(array $value) : void
300
    {
301 3
        $this->NudgePropertyWithUniqueValuesOfThings(
302 3
            'containedInPlace',
303 3
            __METHOD__,
304 3
            $value,
305 3
            Place::class
306
        );
307 3
    }
308
309
    /**
310
    * @return array<int, Place>
311
    */
312 71
    public function GetContainsPlace() : array
313
    {
314
        /**
315
        * @var array<int, Place>
316
        */
317 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
318 71
            'containsPlace',
319 71
            $this->RetrievePropertyValueFromData('containsPlace'),
320 71
            static::class
321
        );
322
323 71
        return $out;
324
    }
325
326
    /**
327
    * @param array<int, Place> $value
328
    */
329 3
    public function SetContainsPlace(array $value) : void
330
    {
331 3
        $this->NudgePropertyWithUniqueValuesOfThings(
332 3
            'containsPlace',
333 3
            __METHOD__,
334 3
            $value,
335 3
            Place::class
336
        );
337 3
    }
338
339
    /**
340
    * @return array<int, GeoCoordinates|GeoShape>
341
    */
342 71
    public function GetGeo() : array
343
    {
344
        /**
345
        * @var array<int, GeoCoordinates|GeoShape>
346
        */
347 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
348 71
            'geo',
349 71
            $this->RetrievePropertyValueFromData('geo'),
350 71
            static::class
351
        );
352
353 71
        return $out;
354
    }
355
356
    /**
357
    * @param array<int, GeoCoordinates|GeoShape> $value
358
    */
359 3
    public function SetGeo(array $value) : void
360
    {
361 3
        $this->NudgePropertyWithUniqueValuesOfThings(
362 3
            'geo',
363 3
            __METHOD__,
364 3
            $value,
365 3
            GeoCoordinates::class,
366 3
            GeoShape::class
367
        );
368 3
    }
369
370
    /**
371
    * @return array<int, string|Map>
372
    */
373 71
    public function GetHasMap() : array
374
    {
375
        /**
376
        * @var array<int, string|Map>
377
        */
378 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
379 71
            'hasMap',
380 71
            $this->RetrievePropertyValueFromData('hasMap'),
381 71
            static::class
382
        );
383
384 71
        return $out;
385
    }
386
387
    /**
388
    * @param array<int, string|Map> $value
389
    */
390 3
    public function SetHasMap(array $value) : void
391
    {
392 3
        $this->NudgePropertyWithUniqueTrimmedStringsOrThings(
393 3
            'hasMap',
394 3
            __METHOD__,
395 3
            $value,
396 3
            Map::class
397
        );
398 3
    }
399
400
    /**
401
    * @return array<int, int>
402
    */
403 71
    public function GetMaximumAttendeeCapacity() : array
404
    {
405
        /**
406
        * @var array<int, int>
407
        */
408 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
409 71
            'maximumAttendeeCapacity',
410 71
            $this->RetrievePropertyValueFromData('maximumAttendeeCapacity'),
411 71
            static::class
412
        );
413
414 71
        return $out;
415
    }
416
417
    /**
418
    * @param array<int, int> $value
419
    */
420 3
    public function SetMaximumAttendeeCapacity(array $value) : void
421
    {
422 3
        $this->NudgePropertyWithUniqueIntegers(
423 3
            'maximumAttendeeCapacity',
424 3
            __METHOD__,
425 3
            $value
426
        );
427 3
    }
428
429
    /**
430
    * @return array<int, OpeningHoursSpecification>
431
    */
432 71
    public function GetOpeningHoursSpecification() : array
433
    {
434
        /**
435
        * @var array<int, OpeningHoursSpecification>
436
        */
437 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
438 71
            'openingHoursSpecification',
439 71
            $this->RetrievePropertyValueFromData('openingHoursSpecification'),
440 71
            static::class
441
        );
442
443 71
        return $out;
444
    }
445
446
    /**
447
    * @param array<int, OpeningHoursSpecification> $value
448
    */
449 3
    public function SetOpeningHoursSpecification(array $value) : void
450
    {
451 3
        $this->NudgePropertyWithUniqueValuesOfThings(
452 3
            'openingHoursSpecification',
453 3
            __METHOD__,
454 3
            $value,
455 3
            OpeningHoursSpecification::class
456
        );
457 3
    }
458
459
    /**
460
    * @return array<int, ImageObject|Photograph>
461
    */
462 71
    public function GetPhoto() : array
463
    {
464
        /**
465
        * @var array<int, ImageObject|Photograph>
466
        */
467 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
468 71
            'photo',
469 71
            $this->RetrievePropertyValueFromData('photo'),
470 71
            static::class
471
        );
472
473 71
        return $out;
474
    }
475
476
    /**
477
    * @param array<int, ImageObject|Photograph> $value
478
    */
479 3
    public function SetPhoto(array $value) : void
480
    {
481 3
        $this->NudgePropertyWithUniqueValuesOfThings(
482 3
            'photo',
483 3
            __METHOD__,
484 3
            $value,
485 3
            ImageObject::class,
486 3
            Photograph::class
487
        );
488 3
    }
489
490
    /**
491
    * @return array<int, bool>
492
    */
493 71
    public function GetPublicAccess() : array
494
    {
495
        /**
496
        * @var array<int, bool>
497
        */
498 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
499 71
            'publicAccess',
500 71
            $this->RetrievePropertyValueFromData('publicAccess'),
501 71
            static::class
502
        );
503
504 71
        return $out;
505
    }
506
507
    /**
508
    * @param array<int, bool> $value
509
    */
510 3
    public function SetPublicAccess(array $value) : void
511
    {
512 3
        $this->NudgePropertyWithUniqueBooleans(
513 3
            'publicAccess',
514 3
            $value
515
        );
516 3
    }
517
518
    /**
519
    * @return array<int, bool>
520
    */
521 71
    public function GetSmokingAllowed() : array
522
    {
523
        /**
524
        * @var array<int, bool>
525
        */
526 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
527 71
            'smokingAllowed',
528 71
            $this->RetrievePropertyValueFromData('smokingAllowed'),
529 71
            static::class
530
        );
531
532 71
        return $out;
533
    }
534
535
    /**
536
    * @param array<int, bool> $value
537
    */
538 3
    public function SetSmokingAllowed(array $value) : void
539
    {
540 3
        $this->NudgePropertyWithUniqueBooleans(
541 3
            'smokingAllowed',
542 3
            $value
543
        );
544 3
    }
545
546
    /**
547
    * @return array<int, OpeningHoursSpecification>
548
    */
549 71
    public function GetSpecialOpeningHoursSpecification() : array
550
    {
551
        /**
552
        * @var array<int, OpeningHoursSpecification>
553
        */
554 71
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
555 71
            'specialOpeningHoursSpecification',
556 71
            $this->RetrievePropertyValueFromData('specialOpeningHoursSpecification'),
557 71
            static::class
558
        );
559
560 71
        return $out;
561
    }
562
563
    /**
564
    * @param array<int, OpeningHoursSpecification> $value
565
    */
566 3
    public function SetSpecialOpeningHoursSpecification(array $value) : void
567
    {
568 3
        $this->NudgePropertyWithUniqueValuesOfThings(
569 3
            'specialOpeningHoursSpecification',
570 3
            __METHOD__,
571 3
            $value,
572 3
            OpeningHoursSpecification::class
573
        );
574 3
    }
575
}
576