1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Geocoder package. |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
* |
10
|
|
|
* @license MIT License |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Geocoder\Provider\GoogleMaps\Model; |
14
|
|
|
|
15
|
|
|
use Geocoder\Model\Address; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @author Tobias Nyholm <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
final class GoogleAddress extends Address |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var string|null |
24
|
|
|
*/ |
25
|
|
|
private $locationType; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var array |
29
|
|
|
*/ |
30
|
|
|
private $resultType = []; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string|null |
34
|
|
|
*/ |
35
|
|
|
private $formattedAddress; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string|null |
39
|
|
|
*/ |
40
|
|
|
private $streetAddress; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string|null |
44
|
|
|
*/ |
45
|
|
|
private $intersection; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string|null |
49
|
|
|
*/ |
50
|
|
|
private $political; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string|null |
54
|
|
|
*/ |
55
|
|
|
private $colloquialArea; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var string|null |
59
|
|
|
*/ |
60
|
|
|
private $ward; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var string|null |
64
|
|
|
*/ |
65
|
|
|
private $neighborhood; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var string|null |
69
|
|
|
*/ |
70
|
|
|
private $premise; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var string|null |
74
|
|
|
*/ |
75
|
|
|
private $subpremise; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var string|null |
79
|
|
|
*/ |
80
|
|
|
private $naturalFeature; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @var string|null |
84
|
|
|
*/ |
85
|
|
|
private $airport; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var string|null |
89
|
|
|
*/ |
90
|
|
|
private $park; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @var string|null |
94
|
|
|
*/ |
95
|
|
|
private $pointOfInterest; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var string|null |
99
|
|
|
*/ |
100
|
|
|
private $establishment; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param null|string $locationType |
104
|
|
|
* |
105
|
|
|
* @return GoogleAddress |
106
|
|
|
*/ |
107
|
15 |
|
public function withLocationType(string $locationType = null) |
108
|
|
|
{ |
109
|
15 |
|
$new = clone $this; |
110
|
15 |
|
$new->locationType = $locationType; |
111
|
|
|
|
112
|
15 |
|
return $new; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return null|string |
117
|
|
|
*/ |
118
|
|
|
public function getLocationType() |
119
|
|
|
{ |
120
|
|
|
return $this->locationType; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return array |
125
|
|
|
*/ |
126
|
|
|
public function getResultType(): array |
127
|
|
|
{ |
128
|
|
|
return $this->resultType; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param array $resultType |
133
|
|
|
* |
134
|
|
|
* @return GoogleAddress |
135
|
|
|
*/ |
136
|
15 |
|
public function withResultType(array $resultType) |
137
|
|
|
{ |
138
|
15 |
|
$new = clone $this; |
139
|
15 |
|
$new->resultType = $resultType; |
140
|
|
|
|
141
|
15 |
|
return $new; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return null|string |
146
|
|
|
*/ |
147
|
|
|
public function getFormattedAddress() |
148
|
|
|
{ |
149
|
|
|
return $this->formattedAddress; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param null|string $formattedAddress |
154
|
|
|
*/ |
155
|
15 |
|
public function withFormattedAddress(string $formattedAddress = null) |
156
|
|
|
{ |
157
|
15 |
|
$new = clone $this; |
158
|
15 |
|
$new->formattedAddress = $formattedAddress; |
159
|
|
|
|
160
|
15 |
|
return $new; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return null|string |
165
|
|
|
*/ |
166
|
1 |
|
public function getAirport() |
167
|
|
|
{ |
168
|
1 |
|
return $this->airport; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param null|string $airport |
173
|
|
|
*/ |
174
|
15 |
|
public function withAirport(string $airport = null) |
175
|
|
|
{ |
176
|
15 |
|
$new = clone $this; |
177
|
15 |
|
$new->airport = $airport; |
178
|
|
|
|
179
|
15 |
|
return $new; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return null|string |
184
|
|
|
*/ |
185
|
1 |
|
public function getColloquialArea() |
186
|
|
|
{ |
187
|
1 |
|
return $this->colloquialArea; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @param null|string $colloquialArea |
192
|
|
|
*/ |
193
|
15 |
|
public function withColloquialArea(string $colloquialArea = null) |
194
|
|
|
{ |
195
|
15 |
|
$new = clone $this; |
196
|
15 |
|
$new->colloquialArea = $colloquialArea; |
197
|
|
|
|
198
|
15 |
|
return $new; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @return null|string |
203
|
|
|
*/ |
204
|
|
|
public function getIntersection() |
205
|
|
|
{ |
206
|
|
|
return $this->intersection; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param null|string $intersection |
211
|
|
|
*/ |
212
|
15 |
|
public function withIntersection(string $intersection = null) |
213
|
|
|
{ |
214
|
15 |
|
$new = clone $this; |
215
|
15 |
|
$new->intersection = $intersection; |
216
|
|
|
|
217
|
15 |
|
return $new; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @return null|string |
222
|
|
|
*/ |
223
|
1 |
|
public function getNaturalFeature() |
224
|
|
|
{ |
225
|
1 |
|
return $this->naturalFeature; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @param null|string $naturalFeature |
230
|
|
|
*/ |
231
|
15 |
|
public function withNaturalFeature(string $naturalFeature = null) |
232
|
|
|
{ |
233
|
15 |
|
$new = clone $this; |
234
|
15 |
|
$new->naturalFeature = $naturalFeature; |
235
|
|
|
|
236
|
15 |
|
return $new; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @return null|string |
241
|
|
|
*/ |
242
|
1 |
|
public function getNeighborhood() |
243
|
|
|
{ |
244
|
1 |
|
return $this->neighborhood; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @param null|string $neighborhood |
249
|
|
|
*/ |
250
|
15 |
|
public function withNeighborhood(string $neighborhood = null) |
251
|
|
|
{ |
252
|
15 |
|
$new = clone $this; |
253
|
15 |
|
$new->neighborhood = $neighborhood; |
254
|
|
|
|
255
|
15 |
|
return $new; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @return null|string |
260
|
|
|
*/ |
261
|
1 |
|
public function getPark() |
262
|
|
|
{ |
263
|
1 |
|
return $this->park; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* @param null|string $park |
268
|
|
|
*/ |
269
|
15 |
|
public function withPark(string $park = null) |
270
|
|
|
{ |
271
|
15 |
|
$new = clone $this; |
272
|
15 |
|
$new->park = $park; |
273
|
|
|
|
274
|
15 |
|
return $new; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @return null|string |
279
|
|
|
*/ |
280
|
2 |
|
public function getPointOfInterest() |
281
|
|
|
{ |
282
|
2 |
|
return $this->pointOfInterest; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @param null|string $pointOfInterest |
287
|
|
|
*/ |
288
|
15 |
|
public function withPointOfInterest(string $pointOfInterest = null) |
289
|
|
|
{ |
290
|
15 |
|
$new = clone $this; |
291
|
15 |
|
$new->pointOfInterest = $pointOfInterest; |
292
|
|
|
|
293
|
15 |
|
return $new; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @return null|string |
298
|
|
|
*/ |
299
|
1 |
|
public function getPolitical() |
300
|
|
|
{ |
301
|
1 |
|
return $this->political; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* @param null|string $political |
306
|
|
|
*/ |
307
|
15 |
|
public function withPolitical(string $political = null) |
308
|
|
|
{ |
309
|
15 |
|
$new = clone $this; |
310
|
15 |
|
$new->political = $political; |
311
|
|
|
|
312
|
15 |
|
return $new; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @return null|string |
317
|
|
|
*/ |
318
|
1 |
|
public function getPremise() |
319
|
|
|
{ |
320
|
1 |
|
return $this->premise; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* @param null|string $premise |
325
|
|
|
*/ |
326
|
15 |
|
public function withPremise($premise = null) |
327
|
|
|
{ |
328
|
15 |
|
$new = clone $this; |
329
|
15 |
|
$new->premise = $premise; |
330
|
|
|
|
331
|
15 |
|
return $new; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* @return null|string |
336
|
|
|
*/ |
337
|
|
|
public function getStreetAddress() |
338
|
|
|
{ |
339
|
|
|
return $this->streetAddress; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* @param null|string $streetAddress |
344
|
|
|
*/ |
345
|
15 |
|
public function withStreetAddress(string $streetAddress = null) |
346
|
|
|
{ |
347
|
15 |
|
$new = clone $this; |
348
|
15 |
|
$new->streetAddress = $streetAddress; |
349
|
|
|
|
350
|
15 |
|
return $new; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* @return null|string |
355
|
|
|
*/ |
356
|
1 |
|
public function getSubpremise() |
357
|
|
|
{ |
358
|
1 |
|
return $this->subpremise; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* @param null|string $subpremise |
363
|
|
|
*/ |
364
|
15 |
|
public function withSubpremise(string $subpremise = null) |
365
|
|
|
{ |
366
|
15 |
|
$new = clone $this; |
367
|
15 |
|
$new->subpremise = $subpremise; |
368
|
|
|
|
369
|
15 |
|
return $new; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* @return null|string |
374
|
|
|
*/ |
375
|
1 |
|
public function getWard() |
376
|
|
|
{ |
377
|
1 |
|
return $this->ward; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @param null|string $ward |
382
|
|
|
*/ |
383
|
15 |
|
public function withWard(string $ward = null) |
384
|
|
|
{ |
385
|
15 |
|
$new = clone $this; |
386
|
15 |
|
$new->ward = $ward; |
387
|
|
|
|
388
|
15 |
|
return $new; |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* @return null|string |
393
|
|
|
*/ |
394
|
1 |
|
public function getEstablishment() |
395
|
|
|
{ |
396
|
1 |
|
return $this->establishment; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* @param null|string $ward |
|
|
|
|
401
|
|
|
*/ |
402
|
15 |
|
public function withEstablishment(string $establishment = null) |
403
|
|
|
{ |
404
|
15 |
|
$new = clone $this; |
405
|
15 |
|
$new->establishment = $establishment; |
406
|
|
|
|
407
|
15 |
|
return $new; |
408
|
|
|
} |
409
|
|
|
} |
410
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.