Completed
Push — master ( 0d6d33...5d031b )
by Tobias
04:08
created

GoogleAddress::withId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
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 $id;
26
27
    /**
28
     * @var string|null
29
     */
30
    private $locationType;
31
32
    /**
33
     * @var array
34
     */
35
    private $resultType = [];
36
37
    /**
38
     * @var string|null
39
     */
40
    private $formattedAddress;
41
42
    /**
43
     * @var string|null
44
     */
45
    private $streetAddress;
46
47
    /**
48
     * @var string|null
49
     */
50
    private $intersection;
51
52
    /**
53
     * @var string|null
54
     */
55
    private $political;
56
57
    /**
58
     * @var string|null
59
     */
60
    private $colloquialArea;
61
62
    /**
63
     * @var string|null
64
     */
65
    private $ward;
66
67
    /**
68
     * @var string|null
69
     */
70
    private $neighborhood;
71
72
    /**
73
     * @var string|null
74
     */
75
    private $premise;
76
77
    /**
78
     * @var string|null
79
     */
80
    private $subpremise;
81
82
    /**
83
     * @var string|null
84
     */
85
    private $naturalFeature;
86
87
    /**
88
     * @var string|null
89
     */
90
    private $airport;
91
92
    /**
93
     * @var string|null
94
     */
95
    private $park;
96
97
    /**
98
     * @var string|null
99
     */
100
    private $pointOfInterest;
101
102
    /**
103
     * @var string|null
104
     */
105
    private $establishment;
106
107
    /**
108
     * @param null|string $id
109
     *
110
     * @return GoogleAddress
111
     */
112 15
    public function withId(string $id = null)
113
    {
114 15
        $new = clone $this;
115 15
        $new->id = $id;
116
117 15
        return $new;
118
    }
119
120
    /**
121
     * @see https://developers.google.com/places/place-id
122
     *
123
     * @return null|string
124
     */
125 3
    public function getId()
126
    {
127 3
        return $this->id;
128
    }
129
130
    /**
131
     * @param null|string $locationType
132
     *
133
     * @return GoogleAddress
134
     */
135 15
    public function withLocationType(string $locationType = null)
136
    {
137 15
        $new = clone $this;
138 15
        $new->locationType = $locationType;
139
140 15
        return $new;
141
    }
142
143
    /**
144
     * @return null|string
145
     */
146
    public function getLocationType()
147
    {
148
        return $this->locationType;
149
    }
150
151
    /**
152
     * @return array
153
     */
154
    public function getResultType(): array
155
    {
156
        return $this->resultType;
157
    }
158
159
    /**
160
     * @param array $resultType
161
     *
162
     * @return GoogleAddress
163
     */
164 15
    public function withResultType(array $resultType)
165
    {
166 15
        $new = clone $this;
167 15
        $new->resultType = $resultType;
168
169 15
        return $new;
170
    }
171
172
    /**
173
     * @return null|string
174
     */
175
    public function getFormattedAddress()
176
    {
177
        return $this->formattedAddress;
178
    }
179
180
    /**
181
     * @param string|null $formattedAddress
182
     *
183
     * @return GoogleAddress
184
     */
185 15
    public function withFormattedAddress(string $formattedAddress = null)
186
    {
187 15
        $new = clone $this;
188 15
        $new->formattedAddress = $formattedAddress;
189
190 15
        return $new;
191
    }
192
193
    /**
194
     * @return null|string
195
     */
196 1
    public function getAirport()
197
    {
198 1
        return $this->airport;
199
    }
200
201
    /**
202
     * @param string|null $airport
203
     *
204
     * @return GoogleAddress
205
     */
206 15
    public function withAirport(string $airport = null)
207
    {
208 15
        $new = clone $this;
209 15
        $new->airport = $airport;
210
211 15
        return $new;
212
    }
213
214
    /**
215
     * @return null|string
216
     */
217 1
    public function getColloquialArea()
218
    {
219 1
        return $this->colloquialArea;
220
    }
221
222
    /**
223
     * @param string|null $colloquialArea
224
     *
225
     * @return GoogleAddress
226
     */
227 15
    public function withColloquialArea(string $colloquialArea = null)
228
    {
229 15
        $new = clone $this;
230 15
        $new->colloquialArea = $colloquialArea;
231
232 15
        return $new;
233
    }
234
235
    /**
236
     * @return null|string
237
     */
238
    public function getIntersection()
239
    {
240
        return $this->intersection;
241
    }
242
243
    /**
244
     * @param string|null $intersection
245
     *
246
     * @return GoogleAddress
247
     */
248 15
    public function withIntersection(string $intersection = null)
249
    {
250 15
        $new = clone $this;
251 15
        $new->intersection = $intersection;
252
253 15
        return $new;
254
    }
255
256
    /**
257
     * @return null|string
258
     */
259 1
    public function getNaturalFeature()
260
    {
261 1
        return $this->naturalFeature;
262
    }
263
264
    /**
265
     * @param string|null $naturalFeature
266
     *
267
     * @return GoogleAddress
268
     */
269 15
    public function withNaturalFeature(string $naturalFeature = null)
270
    {
271 15
        $new = clone $this;
272 15
        $new->naturalFeature = $naturalFeature;
273
274 15
        return $new;
275
    }
276
277
    /**
278
     * @return null|string
279
     */
280 1
    public function getNeighborhood()
281
    {
282 1
        return $this->neighborhood;
283
    }
284
285
    /**
286
     * @param string|null $neighborhood
287
     *
288
     * @return GoogleAddress
289
     */
290 15
    public function withNeighborhood(string $neighborhood = null)
291
    {
292 15
        $new = clone $this;
293 15
        $new->neighborhood = $neighborhood;
294
295 15
        return $new;
296
    }
297
298
    /**
299
     * @return null|string
300
     */
301 1
    public function getPark()
302
    {
303 1
        return $this->park;
304
    }
305
306
    /**
307
     * @param string|null $park
308
     *
309
     * @return GoogleAddress
310
     */
311 15
    public function withPark(string $park = null)
312
    {
313 15
        $new = clone $this;
314 15
        $new->park = $park;
315
316 15
        return $new;
317
    }
318
319
    /**
320
     * @return null|string
321
     */
322 2
    public function getPointOfInterest()
323
    {
324 2
        return $this->pointOfInterest;
325
    }
326
327
    /**
328
     * @param string|null $pointOfInterest
329
     *
330
     * @return GoogleAddress
331
     */
332 15
    public function withPointOfInterest(string $pointOfInterest = null)
333
    {
334 15
        $new = clone $this;
335 15
        $new->pointOfInterest = $pointOfInterest;
336
337 15
        return $new;
338
    }
339
340
    /**
341
     * @return null|string
342
     */
343 1
    public function getPolitical()
344
    {
345 1
        return $this->political;
346
    }
347
348
    /**
349
     * @param string|null $political
350
     *
351
     * @return GoogleAddress
352
     */
353 15
    public function withPolitical(string $political = null)
354
    {
355 15
        $new = clone $this;
356 15
        $new->political = $political;
357
358 15
        return $new;
359
    }
360
361
    /**
362
     * @return null|string
363
     */
364 1
    public function getPremise()
365
    {
366 1
        return $this->premise;
367
    }
368
369
    /**
370
     * @param null $premise
371
     *
372
     * @return GoogleAddress
373
     */
374 15
    public function withPremise(string $premise = null)
375
    {
376 15
        $new = clone $this;
377 15
        $new->premise = $premise;
378
379 15
        return $new;
380
    }
381
382
    /**
383
     * @return null|string
384
     */
385
    public function getStreetAddress()
386
    {
387
        return $this->streetAddress;
388
    }
389
390
    /**
391
     * @param string|null $streetAddress
392
     *
393
     * @return GoogleAddress
394
     */
395 15
    public function withStreetAddress(string $streetAddress = null)
396
    {
397 15
        $new = clone $this;
398 15
        $new->streetAddress = $streetAddress;
399
400 15
        return $new;
401
    }
402
403
    /**
404
     * @return null|string
405
     */
406 1
    public function getSubpremise()
407
    {
408 1
        return $this->subpremise;
409
    }
410
411
    /**
412
     * @param string|null $subpremise
413
     *
414
     * @return GoogleAddress
415
     */
416 15
    public function withSubpremise(string $subpremise = null)
417
    {
418 15
        $new = clone $this;
419 15
        $new->subpremise = $subpremise;
420
421 15
        return $new;
422
    }
423
424
    /**
425
     * @return null|string
426
     */
427 1
    public function getWard()
428
    {
429 1
        return $this->ward;
430
    }
431
432
    /**
433
     * @param string|null $ward
434
     *
435
     * @return GoogleAddress
436
     */
437 15
    public function withWard(string $ward = null)
438
    {
439 15
        $new = clone $this;
440 15
        $new->ward = $ward;
441
442 15
        return $new;
443
    }
444
445
    /**
446
     * @return null|string
447
     */
448 1
    public function getEstablishment()
449
    {
450 1
        return $this->establishment;
451
    }
452
453
    /**
454
     * @param string|null $establishment
455
     *
456
     * @return GoogleAddress
457
     */
458 15
    public function withEstablishment(string $establishment = null)
459
    {
460 15
        $new = clone $this;
461 15
        $new->establishment = $establishment;
462
463 15
        return $new;
464
    }
465
}
466