|
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\CreativeWork; |
|
10
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits; |
|
11
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DataTypes\DateTime; |
|
12
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible as Base; |
|
13
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Offer; |
|
14
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Organization; |
|
15
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Person; |
|
16
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @property array<int, DateTime> $arrivalTime |
|
20
|
|
|
* @property array<int, DateTime> $departureTime |
|
21
|
|
|
* @property array<int, CreativeWork|Trip> $hasPart |
|
22
|
|
|
* @property array<int, CreativeWork|Trip> $isPartOf |
|
23
|
|
|
* @property array<int, ItemList> $itinerary |
|
24
|
|
|
* @property array<int, Offer> $offers |
|
25
|
|
|
* @property array<int, Organization|Person> $provider |
|
26
|
|
|
*/ |
|
27
|
|
|
class Trip extends Base |
|
28
|
|
|
{ |
|
29
|
|
|
use DaftObjectTraits\HasHasPart; |
|
30
|
|
|
use DaftObjectTraits\HasOffers; |
|
31
|
|
|
use DaftObjectTraits\HasProvider; |
|
32
|
|
|
|
|
33
|
|
|
const SCHEMA_ORG_TYPE = 'Trip'; |
|
34
|
|
|
|
|
35
|
|
|
const PROPERTIES = [ |
|
36
|
|
|
'arrivalTime', |
|
37
|
|
|
'departureTime', |
|
38
|
|
|
'hasPart', |
|
39
|
|
|
'isPartOf', |
|
40
|
|
|
'itinerary', |
|
41
|
|
|
'offers', |
|
42
|
|
|
'provider', |
|
43
|
|
|
]; |
|
44
|
|
|
|
|
45
|
|
|
const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [ |
|
46
|
|
|
'arrivalTime' => [ |
|
47
|
|
|
DateTime::class, |
|
48
|
|
|
], |
|
49
|
|
|
'departureTime' => [ |
|
50
|
|
|
DateTime::class, |
|
51
|
|
|
], |
|
52
|
|
|
'hasPart' => [ |
|
53
|
|
|
CreativeWork::class, |
|
54
|
|
|
Trip::class, |
|
55
|
|
|
], |
|
56
|
|
|
'isPartOf' => [ |
|
57
|
|
|
CreativeWork::class, |
|
58
|
|
|
Trip::class, |
|
59
|
|
|
], |
|
60
|
|
|
'itinerary' => [ |
|
61
|
|
|
ItemList::class, |
|
62
|
|
|
], |
|
63
|
|
|
'offers' => [ |
|
64
|
|
|
Offer::class, |
|
65
|
|
|
], |
|
66
|
|
|
'provider' => [ |
|
67
|
|
|
Organization::class, |
|
68
|
|
|
Person::class, |
|
69
|
|
|
], |
|
70
|
|
|
]; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return array<int, DateTime> |
|
74
|
|
|
*/ |
|
75
|
31 |
|
public function GetArrivalTime() : array |
|
76
|
|
|
{ |
|
77
|
|
|
/** |
|
78
|
|
|
* @var array<int, DateTime> |
|
79
|
|
|
*/ |
|
80
|
31 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
81
|
31 |
|
'arrivalTime', |
|
82
|
31 |
|
$this->RetrievePropertyValueFromData('arrivalTime'), |
|
83
|
31 |
|
static::class |
|
84
|
|
|
); |
|
85
|
|
|
|
|
86
|
31 |
|
return $out; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param array<int, DateTime> $value |
|
91
|
|
|
*/ |
|
92
|
1 |
|
public function SetArrivalTime(array $value) : void |
|
93
|
|
|
{ |
|
94
|
1 |
|
$this->NudgePropertyValue( |
|
95
|
1 |
|
'arrivalTime', |
|
96
|
1 |
|
$value |
|
97
|
|
|
); |
|
98
|
1 |
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return array<int, DateTime> |
|
102
|
|
|
*/ |
|
103
|
31 |
|
public function GetDepartureTime() : array |
|
104
|
|
|
{ |
|
105
|
|
|
/** |
|
106
|
|
|
* @var array<int, DateTime> |
|
107
|
|
|
*/ |
|
108
|
31 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
109
|
31 |
|
'departureTime', |
|
110
|
31 |
|
$this->RetrievePropertyValueFromData('departureTime'), |
|
111
|
31 |
|
static::class |
|
112
|
|
|
); |
|
113
|
|
|
|
|
114
|
31 |
|
return $out; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* @param array<int, DateTime> $value |
|
119
|
|
|
*/ |
|
120
|
1 |
|
public function SetDepartureTime(array $value) : void |
|
121
|
|
|
{ |
|
122
|
1 |
|
$this->NudgePropertyValue( |
|
123
|
1 |
|
'departureTime', |
|
124
|
1 |
|
$value |
|
125
|
|
|
); |
|
126
|
1 |
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @return array<int, ItemList> |
|
130
|
|
|
*/ |
|
131
|
31 |
|
public function GetItinerary() : array |
|
132
|
|
|
{ |
|
133
|
|
|
/** |
|
134
|
|
|
* @var array<int, ItemList> |
|
135
|
|
|
*/ |
|
136
|
31 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
137
|
31 |
|
'itinerary', |
|
138
|
31 |
|
$this->RetrievePropertyValueFromData('itinerary'), |
|
139
|
31 |
|
static::class |
|
140
|
|
|
); |
|
141
|
|
|
|
|
142
|
31 |
|
return $out; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param array<int, ItemList> $value |
|
147
|
|
|
*/ |
|
148
|
1 |
|
public function SetItinerary(array $value) : void |
|
149
|
|
|
{ |
|
150
|
1 |
|
$this->NudgePropertyValue( |
|
151
|
1 |
|
'itinerary', |
|
152
|
1 |
|
$value |
|
153
|
|
|
); |
|
154
|
1 |
|
} |
|
155
|
|
|
} |
|
156
|
|
|
|