|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Ivory Google Map package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Eric GELOEN <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please read the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Ivory\GoogleMap\Service\Directions\Response; |
|
13
|
|
|
|
|
14
|
|
|
use Ivory\GoogleMap\Base\Coordinate; |
|
15
|
|
|
use Ivory\GoogleMap\Overlay\EncodedPolyline; |
|
16
|
|
|
use Ivory\GoogleMap\Service\Base\Distance; |
|
17
|
|
|
use Ivory\GoogleMap\Service\Base\Duration; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @see http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsStep |
|
21
|
|
|
* |
|
22
|
|
|
* @author GeLo <[email protected]> |
|
23
|
|
|
*/ |
|
24
|
|
|
class DirectionsStep |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @var Distance|null |
|
28
|
|
|
*/ |
|
29
|
|
|
private $distance; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var Duration|null |
|
33
|
|
|
*/ |
|
34
|
|
|
private $duration; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var Coordinate|null |
|
38
|
|
|
*/ |
|
39
|
|
|
private $endLocation; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var string|null |
|
43
|
|
|
*/ |
|
44
|
|
|
private $instructions; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var EncodedPolyline|null |
|
48
|
|
|
*/ |
|
49
|
|
|
private $encodedPolyline; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var Coordinate|null |
|
53
|
|
|
*/ |
|
54
|
|
|
private $startLocation; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @var string|null |
|
58
|
|
|
*/ |
|
59
|
|
|
private $travelMode; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @var DirectionsTransitDetails|null |
|
63
|
|
|
*/ |
|
64
|
|
|
private $transitDetails; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return bool |
|
68
|
|
|
*/ |
|
69
|
|
|
public function hasDistance() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->distance !== null; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return Distance|null |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getDistance() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->distance; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @param Distance|null $distance |
|
84
|
|
|
*/ |
|
85
|
|
|
public function setDistance(Distance $distance = null) |
|
86
|
|
|
{ |
|
87
|
|
|
$this->distance = $distance; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return bool |
|
92
|
|
|
*/ |
|
93
|
|
|
public function hasDuration() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->duration !== null; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return Duration|null |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getDuration() |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->duration; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param Duration|null $duration |
|
108
|
|
|
*/ |
|
109
|
|
|
public function setDuration(Duration $duration = null) |
|
110
|
|
|
{ |
|
111
|
|
|
$this->duration = $duration; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @return bool |
|
116
|
|
|
*/ |
|
117
|
|
|
public function hasEndLocation() |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->endLocation !== null; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @return Coordinate|null |
|
124
|
|
|
*/ |
|
125
|
|
|
public function getEndLocation() |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->endLocation; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @param Coordinate|null $endLocation |
|
132
|
|
|
*/ |
|
133
|
|
|
public function setEndLocation(Coordinate $endLocation = null) |
|
134
|
|
|
{ |
|
135
|
|
|
$this->endLocation = $endLocation; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @return bool |
|
140
|
|
|
*/ |
|
141
|
|
|
public function hasInstructions() |
|
142
|
|
|
{ |
|
143
|
|
|
return $this->instructions !== null; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @return string|null |
|
148
|
|
|
*/ |
|
149
|
|
|
public function getInstructions() |
|
150
|
|
|
{ |
|
151
|
|
|
return $this->instructions; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @param string|null $instructions |
|
156
|
|
|
*/ |
|
157
|
|
|
public function setInstructions($instructions = null) |
|
158
|
|
|
{ |
|
159
|
|
|
$this->instructions = $instructions; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* @return bool |
|
164
|
|
|
*/ |
|
165
|
|
|
public function hasEncodedPolyline() |
|
166
|
|
|
{ |
|
167
|
|
|
return $this->encodedPolyline !== null; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @return EncodedPolyline|null |
|
172
|
|
|
*/ |
|
173
|
|
|
public function getEncodedPolyline() |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->encodedPolyline; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @param EncodedPolyline|null $encodedPolyline |
|
180
|
|
|
*/ |
|
181
|
|
|
public function setEncodedPolyline(EncodedPolyline $encodedPolyline = null) |
|
182
|
|
|
{ |
|
183
|
|
|
$this->encodedPolyline = $encodedPolyline; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @return bool |
|
188
|
|
|
*/ |
|
189
|
|
|
public function hasStartLocation() |
|
190
|
|
|
{ |
|
191
|
|
|
return $this->startLocation !== null; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @return Coordinate|null |
|
196
|
|
|
*/ |
|
197
|
|
|
public function getStartLocation() |
|
198
|
|
|
{ |
|
199
|
|
|
return $this->startLocation; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @param Coordinate|null $startLocation |
|
204
|
|
|
*/ |
|
205
|
|
|
public function setStartLocation(Coordinate $startLocation = null) |
|
206
|
|
|
{ |
|
207
|
|
|
$this->startLocation = $startLocation; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @return bool |
|
212
|
|
|
*/ |
|
213
|
|
|
public function hasTravelMode() |
|
214
|
|
|
{ |
|
215
|
|
|
return $this->travelMode !== null; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* @return string|null |
|
220
|
|
|
*/ |
|
221
|
|
|
public function getTravelMode() |
|
222
|
|
|
{ |
|
223
|
|
|
return $this->travelMode; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @param string|null $travelMode |
|
228
|
|
|
*/ |
|
229
|
|
|
public function setTravelMode($travelMode = null) |
|
230
|
|
|
{ |
|
231
|
|
|
$this->travelMode = $travelMode; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* @return bool |
|
236
|
|
|
*/ |
|
237
|
|
|
public function hasTransitDetails() |
|
238
|
|
|
{ |
|
239
|
|
|
return $this->transitDetails !== null; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
/** |
|
243
|
|
|
* @return DirectionsTransitDetails|null |
|
244
|
|
|
*/ |
|
245
|
|
|
public function getTransitDetails() |
|
246
|
|
|
{ |
|
247
|
|
|
return $this->transitDetails; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @param DirectionsTransitDetails|null $transitDetails |
|
252
|
|
|
*/ |
|
253
|
|
|
public function setTransitDetails(DirectionsTransitDetails $transitDetails = null) |
|
254
|
|
|
{ |
|
255
|
|
|
$this->transitDetails = $transitDetails; |
|
256
|
|
|
} |
|
257
|
|
|
} |
|
258
|
|
|
|