|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author SignpostMarv |
|
4
|
|
|
*/ |
|
5
|
|
|
declare(strict_types=1); |
|
6
|
|
|
|
|
7
|
|
|
namespace SignpostMarv\DaftObject\SchemaOrg\Intangible; |
|
8
|
|
|
|
|
9
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Audience; |
|
10
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\MediaObject\ImageObject; |
|
11
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\Review; |
|
12
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits; |
|
13
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\GeoShape; |
|
14
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible as Base; |
|
15
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Enumeration\PhysicalActivityCategory; |
|
16
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\ItemList\OfferCatalog; |
|
17
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Rating\AggregateRating; |
|
18
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\OpeningHoursSpecification; |
|
19
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Offer; |
|
20
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Organization; |
|
21
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Person; |
|
22
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Place; |
|
23
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Place\AdministrativeArea; |
|
24
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Product; |
|
25
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Thing; |
|
26
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @property array<int, AggregateRating> $aggregateRating |
|
30
|
|
|
* @property array<int, string|AdministrativeArea|GeoShape|Place> $areaServed |
|
31
|
|
|
* @property array<int, Audience> $audience |
|
32
|
|
|
* @property array<int, ServiceChannel> $availableChannel |
|
33
|
|
|
* @property array<int, string> $award |
|
34
|
|
|
* @property array<int, Brand|Organization> $brand |
|
35
|
|
|
* @property array<int, Organization|Person> $broker |
|
36
|
|
|
* @property array<int, string|PhysicalActivityCategory|Thing> $category |
|
37
|
|
|
* @property array<int, OfferCatalog> $hasOfferCatalog |
|
38
|
|
|
* @property array<int, OpeningHoursSpecification> $hoursAvailable |
|
39
|
|
|
* @property array<int, Product|Service> $isRelatedTo |
|
40
|
|
|
* @property array<int, Product|Service> $isSimilarTo |
|
41
|
|
|
* @property array<int, ImageObject> $logo |
|
42
|
|
|
* @property array<int, Offer> $offers |
|
43
|
|
|
* @property array<int, Organization|Person> $provider |
|
44
|
|
|
* @property array<int, string> $providerMobility |
|
45
|
|
|
* @property array<int, Review> $review |
|
46
|
|
|
* @property array<int, string> $serviceOutput |
|
47
|
|
|
* @property array<int, string> $serviceType |
|
48
|
|
|
* @property array<int, string> $termsOfService |
|
49
|
|
|
*/ |
|
50
|
|
|
class Service extends Base |
|
51
|
|
|
{ |
|
52
|
|
|
use DaftObjectTraits\HasAggregateRating; |
|
53
|
|
|
use DaftObjectTraits\HasAreaServed; |
|
54
|
|
|
use DaftObjectTraits\HasAudience; |
|
55
|
|
|
use DaftObjectTraits\HasAward; |
|
56
|
|
|
use DaftObjectTraits\HasBrand; |
|
57
|
|
|
use DaftObjectTraits\HasCategory; |
|
58
|
|
|
use DaftObjectTraits\HasHasOfferCatalog; |
|
59
|
|
|
use DaftObjectTraits\HasHoursAvailable; |
|
60
|
|
|
use DaftObjectTraits\HasLogo; |
|
61
|
|
|
use DaftObjectTraits\HasOffers; |
|
62
|
|
|
use DaftObjectTraits\HasProvider; |
|
63
|
|
|
use DaftObjectTraits\HasReview; |
|
64
|
|
|
use DaftObjectTraits\IsRelatedOrSimilarTo; |
|
65
|
|
|
|
|
66
|
|
|
const SCHEMA_ORG_TYPE = 'Service'; |
|
67
|
|
|
|
|
68
|
|
|
const PROPERTIES = [ |
|
69
|
|
|
'aggregateRating', |
|
70
|
|
|
'areaServed', |
|
71
|
|
|
'audience', |
|
72
|
|
|
'availableChannel', |
|
73
|
|
|
'award', |
|
74
|
|
|
'brand', |
|
75
|
|
|
'broker', |
|
76
|
|
|
'category', |
|
77
|
|
|
'hasOfferCatalog', |
|
78
|
|
|
'hoursAvailable', |
|
79
|
|
|
'isRelatedTo', |
|
80
|
|
|
'isSimilarTo', |
|
81
|
|
|
'logo', |
|
82
|
|
|
'offers', |
|
83
|
|
|
'provider', |
|
84
|
|
|
'providerMobility', |
|
85
|
|
|
'review', |
|
86
|
|
|
'serviceOutput', |
|
87
|
|
|
'serviceType', |
|
88
|
|
|
'termsOfService', |
|
89
|
|
|
]; |
|
90
|
|
|
|
|
91
|
|
|
const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [ |
|
92
|
|
|
'aggregateRating' => [ |
|
93
|
|
|
AggregateRating::class, |
|
94
|
|
|
], |
|
95
|
|
|
'areaServed' => [ |
|
96
|
|
|
'string', |
|
97
|
|
|
AdministrativeArea::class, |
|
98
|
|
|
GeoShape::class, |
|
99
|
|
|
Place::class, |
|
100
|
|
|
], |
|
101
|
|
|
'audience' => [ |
|
102
|
|
|
Audience::class, |
|
103
|
|
|
], |
|
104
|
|
|
'availableChannel' => [ |
|
105
|
|
|
ServiceChannel::class, |
|
106
|
|
|
], |
|
107
|
|
|
'award' => [ |
|
108
|
|
|
'string', |
|
109
|
|
|
], |
|
110
|
|
|
'brand' => [ |
|
111
|
|
|
Brand::class, |
|
112
|
|
|
Organization::class, |
|
113
|
|
|
], |
|
114
|
|
|
'broker' => [ |
|
115
|
|
|
Organization::class, |
|
116
|
|
|
Person::class, |
|
117
|
|
|
], |
|
118
|
|
|
'category' => [ |
|
119
|
|
|
'string', |
|
120
|
|
|
PhysicalActivityCategory::class, |
|
121
|
|
|
Thing::class, |
|
122
|
|
|
], |
|
123
|
|
|
'hasOfferCatalog' => [ |
|
124
|
|
|
OfferCatalog::class, |
|
125
|
|
|
], |
|
126
|
|
|
'hoursAvailable' => [ |
|
127
|
|
|
OpeningHoursSpecification::class, |
|
128
|
|
|
], |
|
129
|
|
|
'isRelatedTo' => [ |
|
130
|
|
|
Product::class, |
|
131
|
|
|
Service::class, |
|
132
|
|
|
], |
|
133
|
|
|
'isSimilarTo' => [ |
|
134
|
|
|
Product::class, |
|
135
|
|
|
Service::class, |
|
136
|
|
|
], |
|
137
|
|
|
'logo' => [ |
|
138
|
|
|
ImageObject::class, |
|
139
|
|
|
], |
|
140
|
|
|
'offers' => [ |
|
141
|
|
|
Offer::class, |
|
142
|
|
|
], |
|
143
|
|
|
'provider' => [ |
|
144
|
|
|
Organization::class, |
|
145
|
|
|
Person::class, |
|
146
|
|
|
], |
|
147
|
|
|
'providerMobility' => [ |
|
148
|
|
|
'string', |
|
149
|
|
|
], |
|
150
|
|
|
'review' => [ |
|
151
|
|
|
Review::class, |
|
152
|
|
|
], |
|
153
|
|
|
'serviceOutput' => [ |
|
154
|
|
|
'string', |
|
155
|
|
|
], |
|
156
|
|
|
'serviceType' => [ |
|
157
|
|
|
'string', |
|
158
|
|
|
], |
|
159
|
|
|
'termsOfService' => [ |
|
160
|
|
|
'string', |
|
161
|
|
|
], |
|
162
|
|
|
]; |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @return array<int, ServiceChannel> |
|
166
|
|
|
*/ |
|
167
|
28 |
|
public function GetAvailableChannel() : array |
|
168
|
|
|
{ |
|
169
|
|
|
/** |
|
170
|
|
|
* @var array<int, ServiceChannel> |
|
171
|
|
|
*/ |
|
172
|
28 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
173
|
28 |
|
'availableChannel', |
|
174
|
28 |
|
$this->RetrievePropertyValueFromData('availableChannel'), |
|
175
|
28 |
|
static::class |
|
176
|
|
|
); |
|
177
|
|
|
|
|
178
|
28 |
|
return $out; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @param array<int, ServiceChannel> $value |
|
183
|
|
|
*/ |
|
184
|
9 |
|
public function SetAvailableChannel(array $value) : void |
|
185
|
|
|
{ |
|
186
|
9 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
187
|
9 |
|
'availableChannel', |
|
188
|
9 |
|
__METHOD__, |
|
189
|
9 |
|
$value, |
|
190
|
9 |
|
ServiceChannel::class |
|
191
|
|
|
); |
|
192
|
9 |
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @return array<int, Organization|Person> |
|
196
|
|
|
*/ |
|
197
|
28 |
|
public function GetBroker() : array |
|
198
|
|
|
{ |
|
199
|
|
|
/** |
|
200
|
|
|
* @var array<int, Organization|Person> |
|
201
|
|
|
*/ |
|
202
|
28 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
203
|
28 |
|
'broker', |
|
204
|
28 |
|
$this->RetrievePropertyValueFromData('broker'), |
|
205
|
28 |
|
static::class |
|
206
|
|
|
); |
|
207
|
|
|
|
|
208
|
28 |
|
return $out; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* @param array<int, Organization|Person> $value |
|
213
|
|
|
*/ |
|
214
|
9 |
|
public function SetBroker(array $value) : void |
|
215
|
|
|
{ |
|
216
|
9 |
|
$this->NudgePropertyWithUniqueOrganizationsOrPersons( |
|
217
|
9 |
|
'broker', |
|
218
|
9 |
|
__METHOD__, |
|
219
|
9 |
|
$value |
|
220
|
|
|
); |
|
221
|
9 |
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* @return array<int, string> |
|
225
|
|
|
*/ |
|
226
|
28 |
|
public function GetProviderMobility() : array |
|
227
|
|
|
{ |
|
228
|
|
|
/** |
|
229
|
|
|
* @var array<int, string> |
|
230
|
|
|
*/ |
|
231
|
28 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
232
|
28 |
|
'providerMobility', |
|
233
|
28 |
|
$this->RetrievePropertyValueFromData('providerMobility'), |
|
234
|
28 |
|
static::class |
|
235
|
|
|
); |
|
236
|
|
|
|
|
237
|
28 |
|
return $out; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* @param array<int, string> $value |
|
242
|
|
|
*/ |
|
243
|
9 |
|
public function SetProviderMobility(array $value) : void |
|
244
|
|
|
{ |
|
245
|
9 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
246
|
9 |
|
'providerMobility', |
|
247
|
9 |
|
__METHOD__, |
|
248
|
9 |
|
$value |
|
249
|
|
|
); |
|
250
|
9 |
|
} |
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* @return array<int, string> |
|
254
|
|
|
*/ |
|
255
|
28 |
|
public function GetServiceOutput() : array |
|
256
|
|
|
{ |
|
257
|
|
|
/** |
|
258
|
|
|
* @var array<int, string> |
|
259
|
|
|
*/ |
|
260
|
28 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
261
|
28 |
|
'serviceOutput', |
|
262
|
28 |
|
$this->RetrievePropertyValueFromData('serviceOutput'), |
|
263
|
28 |
|
static::class |
|
264
|
|
|
); |
|
265
|
|
|
|
|
266
|
28 |
|
return $out; |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
/** |
|
270
|
|
|
* @param array<int, string> $value |
|
271
|
|
|
*/ |
|
272
|
9 |
|
public function SetServiceOutput(array $value) : void |
|
273
|
|
|
{ |
|
274
|
9 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
275
|
9 |
|
'serviceOutput', |
|
276
|
9 |
|
__METHOD__, |
|
277
|
9 |
|
$value |
|
278
|
|
|
); |
|
279
|
9 |
|
} |
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* @return array<int, string> |
|
283
|
|
|
*/ |
|
284
|
28 |
|
public function GetServiceType() : array |
|
285
|
|
|
{ |
|
286
|
|
|
/** |
|
287
|
|
|
* @var array<int, string> |
|
288
|
|
|
*/ |
|
289
|
28 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
290
|
28 |
|
'serviceType', |
|
291
|
28 |
|
$this->RetrievePropertyValueFromData('serviceType'), |
|
292
|
28 |
|
static::class |
|
293
|
|
|
); |
|
294
|
|
|
|
|
295
|
28 |
|
return $out; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
/** |
|
299
|
|
|
* @param array<int, string> $value |
|
300
|
|
|
*/ |
|
301
|
9 |
|
public function SetServiceType(array $value) : void |
|
302
|
|
|
{ |
|
303
|
9 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
304
|
9 |
|
'serviceType', |
|
305
|
9 |
|
__METHOD__, |
|
306
|
9 |
|
$value |
|
307
|
|
|
); |
|
308
|
9 |
|
} |
|
309
|
|
|
|
|
310
|
|
|
/** |
|
311
|
|
|
* @return array<int, string> |
|
312
|
|
|
*/ |
|
313
|
28 |
|
public function GetTermsOfService() : array |
|
314
|
|
|
{ |
|
315
|
|
|
/** |
|
316
|
|
|
* @var array<int, string> |
|
317
|
|
|
*/ |
|
318
|
28 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
319
|
28 |
|
'termsOfService', |
|
320
|
28 |
|
$this->RetrievePropertyValueFromData('termsOfService'), |
|
321
|
28 |
|
static::class |
|
322
|
|
|
); |
|
323
|
|
|
|
|
324
|
28 |
|
return $out; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* @param array<int, string> $value |
|
329
|
|
|
*/ |
|
330
|
9 |
|
public function SetTermsOfService(array $value) : void |
|
331
|
|
|
{ |
|
332
|
9 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
333
|
9 |
|
'termsOfService', |
|
334
|
9 |
|
__METHOD__, |
|
335
|
9 |
|
$value |
|
336
|
|
|
); |
|
337
|
9 |
|
} |
|
338
|
|
|
} |
|
339
|
|
|
|