|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author SignpostMarv |
|
4
|
|
|
*/ |
|
5
|
|
|
declare(strict_types=1); |
|
6
|
|
|
|
|
7
|
|
|
namespace SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits; |
|
8
|
|
|
|
|
9
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Enumeration\DeliveryMethod; |
|
10
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Service; |
|
11
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\QuantitativeValue; |
|
12
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\WarrantyPromise; |
|
13
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Organization; |
|
14
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Person; |
|
15
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Place; |
|
16
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\PriceSpecification; |
|
17
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Product; |
|
18
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities; |
|
19
|
|
|
|
|
20
|
|
|
trait IsOfferOrDemand |
|
21
|
|
|
{ |
|
22
|
|
|
use AcceptedPaymentMethod; |
|
23
|
|
|
use AdvanceBookingRequirement; |
|
24
|
|
|
use HasAreaServed; |
|
25
|
|
|
use AvailabilityAndStartsAndEnds; |
|
26
|
|
|
use BusinessFunction; |
|
27
|
|
|
use DeliveryLeadTime; |
|
28
|
|
|
use EligibleCustomerTypeAndDurationAndQuantityAndRegionAndTransactionVolumeAndIneligibleRegion; |
|
29
|
|
|
use HasGtin; |
|
30
|
|
|
use IncludesObject; |
|
31
|
|
|
use HasValidFromThrough; |
|
32
|
|
|
use HasSku; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @return array<int, Place> |
|
36
|
|
|
*/ |
|
37
|
72 |
|
public function GetAvailableAtOrFrom() : array |
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* @var array<int, Place> |
|
41
|
|
|
*/ |
|
42
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
43
|
72 |
|
'availableAtOrFrom', |
|
44
|
72 |
|
$this->RetrievePropertyValueFromData('availableAtOrFrom'), |
|
|
|
|
|
|
45
|
72 |
|
static::class |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
72 |
|
return $out; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @param array<int, Place> $value |
|
53
|
|
|
*/ |
|
54
|
1 |
|
public function SetAvailableAtOrFrom(array $value) : void |
|
55
|
|
|
{ |
|
56
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
57
|
1 |
|
'availableAtOrFrom', |
|
58
|
1 |
|
__METHOD__, |
|
59
|
1 |
|
$value, |
|
60
|
1 |
|
Place::class |
|
61
|
|
|
); |
|
62
|
1 |
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return array<int, DeliveryMethod> |
|
66
|
|
|
*/ |
|
67
|
72 |
|
public function GetAvailableDeliveryMethod() : array |
|
68
|
|
|
{ |
|
69
|
|
|
/** |
|
70
|
|
|
* @var array<int, DeliveryMethod> |
|
71
|
|
|
*/ |
|
72
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
73
|
72 |
|
'availableDeliveryMethod', |
|
74
|
72 |
|
$this->RetrievePropertyValueFromData('availableDeliveryMethod'), |
|
75
|
72 |
|
static::class |
|
76
|
|
|
); |
|
77
|
|
|
|
|
78
|
72 |
|
return $out; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param array<int, DeliveryMethod> $value |
|
83
|
|
|
*/ |
|
84
|
1 |
|
public function SetAvailableDeliveryMethod(array $value) : void |
|
85
|
|
|
{ |
|
86
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
87
|
1 |
|
'availableDeliveryMethod', |
|
88
|
1 |
|
__METHOD__, |
|
89
|
1 |
|
$value, |
|
90
|
1 |
|
DeliveryMethod::class |
|
91
|
|
|
); |
|
92
|
1 |
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return array<int, QuantitativeValue> |
|
96
|
|
|
*/ |
|
97
|
72 |
|
public function GetInventoryLevel() : array |
|
98
|
|
|
{ |
|
99
|
|
|
/** |
|
100
|
|
|
* @var array<int, QuantitativeValue> |
|
101
|
|
|
*/ |
|
102
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
103
|
72 |
|
'inventoryLevel', |
|
104
|
72 |
|
$this->RetrievePropertyValueFromData('inventoryLevel'), |
|
105
|
72 |
|
static::class |
|
106
|
|
|
); |
|
107
|
|
|
|
|
108
|
72 |
|
return $out; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param array<int, QuantitativeValue> $value |
|
113
|
|
|
*/ |
|
114
|
1 |
|
public function SetInventoryLevel(array $value) : void |
|
115
|
|
|
{ |
|
116
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
117
|
1 |
|
'inventoryLevel', |
|
118
|
1 |
|
__METHOD__, |
|
119
|
1 |
|
$value, |
|
120
|
1 |
|
QuantitativeValue::class |
|
121
|
|
|
); |
|
122
|
1 |
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return array<int, Product|Service> |
|
126
|
|
|
*/ |
|
127
|
72 |
|
public function GetItemOffered() : array |
|
128
|
|
|
{ |
|
129
|
|
|
/** |
|
130
|
|
|
* @var array<int, Product|Service> |
|
131
|
|
|
*/ |
|
132
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
133
|
72 |
|
'itemOffered', |
|
134
|
72 |
|
$this->RetrievePropertyValueFromData('itemOffered'), |
|
135
|
72 |
|
static::class |
|
136
|
|
|
); |
|
137
|
|
|
|
|
138
|
72 |
|
return $out; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* @param array<int, Product|Service> $value |
|
143
|
|
|
*/ |
|
144
|
1 |
|
public function SetItemOffered(array $value) : void |
|
145
|
|
|
{ |
|
146
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
147
|
1 |
|
'itemOffered', |
|
148
|
1 |
|
__METHOD__, |
|
149
|
1 |
|
$value, |
|
150
|
1 |
|
Product::class, |
|
151
|
1 |
|
Service::class |
|
152
|
|
|
); |
|
153
|
1 |
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @return array<int, PriceSpecification> |
|
157
|
|
|
*/ |
|
158
|
72 |
|
public function GetPriceSpecification() : array |
|
159
|
|
|
{ |
|
160
|
|
|
/** |
|
161
|
|
|
* @var array<int, PriceSpecification> |
|
162
|
|
|
*/ |
|
163
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
164
|
72 |
|
'priceSpecification', |
|
165
|
72 |
|
$this->RetrievePropertyValueFromData('priceSpecification'), |
|
166
|
72 |
|
static::class |
|
167
|
|
|
); |
|
168
|
|
|
|
|
169
|
72 |
|
return $out; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* @param array<int, PriceSpecification> $value |
|
174
|
|
|
*/ |
|
175
|
1 |
|
public function SetPriceSpecification(array $value) : void |
|
176
|
|
|
{ |
|
177
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
178
|
1 |
|
'priceSpecification', |
|
179
|
1 |
|
__METHOD__, |
|
180
|
1 |
|
$value, |
|
181
|
1 |
|
PriceSpecification::class |
|
182
|
|
|
); |
|
183
|
1 |
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @return array<int, Organization|Person> |
|
187
|
|
|
*/ |
|
188
|
72 |
|
public function GetSeller() : array |
|
189
|
|
|
{ |
|
190
|
|
|
/** |
|
191
|
|
|
* @var array<int, Organization|Person> |
|
192
|
|
|
*/ |
|
193
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
194
|
72 |
|
'seller', |
|
195
|
72 |
|
$this->RetrievePropertyValueFromData('seller'), |
|
196
|
72 |
|
static::class |
|
197
|
|
|
); |
|
198
|
|
|
|
|
199
|
72 |
|
return $out; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @param array<int, Organization|Person> $value |
|
204
|
|
|
*/ |
|
205
|
1 |
|
public function SetSeller(array $value) : void |
|
206
|
|
|
{ |
|
207
|
1 |
|
$this->NudgePropertyWithUniqueOrganizationsOrPersons( |
|
|
|
|
|
|
208
|
1 |
|
'seller', |
|
209
|
1 |
|
__METHOD__, |
|
210
|
1 |
|
$value |
|
211
|
|
|
); |
|
212
|
1 |
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @return array<int, string> |
|
216
|
|
|
*/ |
|
217
|
72 |
|
public function GetSerialNumber() : array |
|
218
|
|
|
{ |
|
219
|
|
|
/** |
|
220
|
|
|
* @var array<int, string> |
|
221
|
|
|
*/ |
|
222
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
223
|
72 |
|
'serialNumber', |
|
224
|
72 |
|
$this->RetrievePropertyValueFromData('serialNumber'), |
|
225
|
72 |
|
static::class |
|
226
|
|
|
); |
|
227
|
|
|
|
|
228
|
72 |
|
return $out; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* @param array<int, string> $value |
|
233
|
|
|
*/ |
|
234
|
1 |
|
public function SetSerialNumber(array $value) : void |
|
235
|
|
|
{ |
|
236
|
1 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
|
|
|
|
|
237
|
1 |
|
'serialNumber', |
|
238
|
1 |
|
__METHOD__, |
|
239
|
1 |
|
$value |
|
240
|
|
|
); |
|
241
|
1 |
|
} |
|
242
|
|
|
|
|
243
|
|
|
/** |
|
244
|
|
|
* @return array<int, WarrantyPromise> |
|
245
|
|
|
*/ |
|
246
|
72 |
|
public function GetWarranty() : array |
|
247
|
|
|
{ |
|
248
|
|
|
/** |
|
249
|
|
|
* @var array<int, WarrantyPromise> |
|
250
|
|
|
*/ |
|
251
|
72 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
252
|
72 |
|
'warranty', |
|
253
|
72 |
|
$this->RetrievePropertyValueFromData('warranty'), |
|
254
|
72 |
|
static::class |
|
255
|
|
|
); |
|
256
|
|
|
|
|
257
|
72 |
|
return $out; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* @param array<int, WarrantyPromise> $value |
|
262
|
|
|
*/ |
|
263
|
1 |
|
public function SetWarranty(array $value) : void |
|
264
|
|
|
{ |
|
265
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
266
|
1 |
|
'warranty', |
|
267
|
1 |
|
__METHOD__, |
|
268
|
1 |
|
$value, |
|
269
|
1 |
|
WarrantyPromise::class |
|
270
|
|
|
); |
|
271
|
1 |
|
} |
|
272
|
|
|
} |
|
273
|
|
|
|