GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 691675...503bab )
by Tobias
07:29 queued 04:40
created

GoogleAddress::withPremise()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 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
use Geocoder\Model\AdminLevel;
17
use Geocoder\Model\AdminLevelCollection;
18
19
/**
20
 * @author Tobias Nyholm <[email protected]>
21
 */
22
final class GoogleAddress extends Address
23
{
24
    /**
25
     * @var string|null
26
     */
27
    private $id;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $locationType;
33
34
    /**
35
     * @var array
36
     */
37
    private $resultType = [];
38
39
    /**
40
     * @var string|null
41
     */
42
    private $formattedAddress;
43
44
    /**
45
     * @var string|null
46
     */
47
    private $streetAddress;
48
49
    /**
50
     * @var string|null
51
     */
52
    private $intersection;
53
54
    /**
55
     * @var string|null
56
     */
57
    private $political;
58
59
    /**
60
     * @var string|null
61
     */
62
    private $colloquialArea;
63
64
    /**
65
     * @var string|null
66
     */
67
    private $ward;
68
69
    /**
70
     * @var string|null
71
     */
72
    private $neighborhood;
73
74
    /**
75
     * @var string|null
76
     */
77
    private $premise;
78
79
    /**
80
     * @var string|null
81
     */
82
    private $subpremise;
83
84
    /**
85
     * @var string|null
86
     */
87
    private $naturalFeature;
88
89
    /**
90
     * @var string|null
91
     */
92
    private $airport;
93
94
    /**
95
     * @var string|null
96
     */
97
    private $park;
98
99
    /**
100
     * @var string|null
101
     */
102
    private $pointOfInterest;
103
104
    /**
105
     * @var string|null
106
     */
107
    private $establishment;
108
109
    /**
110
     * @var AdminLevelCollection
111
     */
112
    private $subLocalityLevels;
113
114
    /**
115
     * @param null|string $id
116
     *
117
     * @return GoogleAddress
118
     */
119
    public function withId(string $id = null)
120
    {
121
        $new = clone $this;
122
        $new->id = $id;
123
124
        return $new;
125
    }
126
127
    /**
128
     * @see https://developers.google.com/places/place-id
129
     *
130
     * @return null|string
131
     */
132
    public function getId()
133
    {
134
        return $this->id;
135
    }
136
137
    /**
138
     * @param null|string $locationType
139
     *
140
     * @return GoogleAddress
141
     */
142
    public function withLocationType(string $locationType = null)
143
    {
144
        $new = clone $this;
145
        $new->locationType = $locationType;
146
147
        return $new;
148
    }
149
150
    /**
151
     * @return null|string
152
     */
153
    public function getLocationType()
154
    {
155
        return $this->locationType;
156
    }
157
158
    /**
159
     * @return array
160
     */
161
    public function getResultType(): array
162
    {
163
        return $this->resultType;
164
    }
165
166
    /**
167
     * @param array $resultType
168
     *
169
     * @return GoogleAddress
170
     */
171
    public function withResultType(array $resultType)
172
    {
173
        $new = clone $this;
174
        $new->resultType = $resultType;
175
176
        return $new;
177
    }
178
179
    /**
180
     * @return null|string
181
     */
182
    public function getFormattedAddress()
183
    {
184
        return $this->formattedAddress;
185
    }
186
187
    /**
188
     * @param string|null $formattedAddress
189
     *
190
     * @return GoogleAddress
191
     */
192
    public function withFormattedAddress(string $formattedAddress = null)
193
    {
194
        $new = clone $this;
195
        $new->formattedAddress = $formattedAddress;
196
197
        return $new;
198
    }
199
200
    /**
201
     * @return null|string
202
     */
203
    public function getAirport()
204
    {
205
        return $this->airport;
206
    }
207
208
    /**
209
     * @param string|null $airport
210
     *
211
     * @return GoogleAddress
212
     */
213
    public function withAirport(string $airport = null)
214
    {
215
        $new = clone $this;
216
        $new->airport = $airport;
217
218
        return $new;
219
    }
220
221
    /**
222
     * @return null|string
223
     */
224
    public function getColloquialArea()
225
    {
226
        return $this->colloquialArea;
227
    }
228
229
    /**
230
     * @param string|null $colloquialArea
231
     *
232
     * @return GoogleAddress
233
     */
234
    public function withColloquialArea(string $colloquialArea = null)
235
    {
236
        $new = clone $this;
237
        $new->colloquialArea = $colloquialArea;
238
239
        return $new;
240
    }
241
242
    /**
243
     * @return null|string
244
     */
245
    public function getIntersection()
246
    {
247
        return $this->intersection;
248
    }
249
250
    /**
251
     * @param string|null $intersection
252
     *
253
     * @return GoogleAddress
254
     */
255
    public function withIntersection(string $intersection = null)
256
    {
257
        $new = clone $this;
258
        $new->intersection = $intersection;
259
260
        return $new;
261
    }
262
263
    /**
264
     * @return null|string
265
     */
266
    public function getNaturalFeature()
267
    {
268
        return $this->naturalFeature;
269
    }
270
271
    /**
272
     * @param string|null $naturalFeature
273
     *
274
     * @return GoogleAddress
275
     */
276
    public function withNaturalFeature(string $naturalFeature = null)
277
    {
278
        $new = clone $this;
279
        $new->naturalFeature = $naturalFeature;
280
281
        return $new;
282
    }
283
284
    /**
285
     * @return null|string
286
     */
287
    public function getNeighborhood()
288
    {
289
        return $this->neighborhood;
290
    }
291
292
    /**
293
     * @param string|null $neighborhood
294
     *
295
     * @return GoogleAddress
296
     */
297
    public function withNeighborhood(string $neighborhood = null)
298
    {
299
        $new = clone $this;
300
        $new->neighborhood = $neighborhood;
301
302
        return $new;
303
    }
304
305
    /**
306
     * @return null|string
307
     */
308
    public function getPark()
309
    {
310
        return $this->park;
311
    }
312
313
    /**
314
     * @param string|null $park
315
     *
316
     * @return GoogleAddress
317
     */
318
    public function withPark(string $park = null)
319
    {
320
        $new = clone $this;
321
        $new->park = $park;
322
323
        return $new;
324
    }
325
326
    /**
327
     * @return null|string
328
     */
329
    public function getPointOfInterest()
330
    {
331
        return $this->pointOfInterest;
332
    }
333
334
    /**
335
     * @param string|null $pointOfInterest
336
     *
337
     * @return GoogleAddress
338
     */
339
    public function withPointOfInterest(string $pointOfInterest = null)
340
    {
341
        $new = clone $this;
342
        $new->pointOfInterest = $pointOfInterest;
343
344
        return $new;
345
    }
346
347
    /**
348
     * @return null|string
349
     */
350
    public function getPolitical()
351
    {
352
        return $this->political;
353
    }
354
355
    /**
356
     * @param string|null $political
357
     *
358
     * @return GoogleAddress
359
     */
360
    public function withPolitical(string $political = null)
361
    {
362
        $new = clone $this;
363
        $new->political = $political;
364
365
        return $new;
366
    }
367
368
    /**
369
     * @return null|string
370
     */
371
    public function getPremise()
372
    {
373
        return $this->premise;
374
    }
375
376
    /**
377
     * @param null $premise
0 ignored issues
show
Documentation introduced by
Should the type for parameter $premise not be null|string?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
378
     *
379
     * @return GoogleAddress
380
     */
381
    public function withPremise(string $premise = null)
382
    {
383
        $new = clone $this;
384
        $new->premise = $premise;
385
386
        return $new;
387
    }
388
389
    /**
390
     * @return null|string
391
     */
392
    public function getStreetAddress()
393
    {
394
        return $this->streetAddress;
395
    }
396
397
    /**
398
     * @param string|null $streetAddress
399
     *
400
     * @return GoogleAddress
401
     */
402
    public function withStreetAddress(string $streetAddress = null)
403
    {
404
        $new = clone $this;
405
        $new->streetAddress = $streetAddress;
406
407
        return $new;
408
    }
409
410
    /**
411
     * @return null|string
412
     */
413
    public function getSubpremise()
414
    {
415
        return $this->subpremise;
416
    }
417
418
    /**
419
     * @param string|null $subpremise
420
     *
421
     * @return GoogleAddress
422
     */
423
    public function withSubpremise(string $subpremise = null)
424
    {
425
        $new = clone $this;
426
        $new->subpremise = $subpremise;
427
428
        return $new;
429
    }
430
431
    /**
432
     * @return null|string
433
     */
434
    public function getWard()
435
    {
436
        return $this->ward;
437
    }
438
439
    /**
440
     * @param string|null $ward
441
     *
442
     * @return GoogleAddress
443
     */
444
    public function withWard(string $ward = null)
445
    {
446
        $new = clone $this;
447
        $new->ward = $ward;
448
449
        return $new;
450
    }
451
452
    /**
453
     * @return null|string
454
     */
455
    public function getEstablishment()
456
    {
457
        return $this->establishment;
458
    }
459
460
    /**
461
     * @param string|null $establishment
462
     *
463
     * @return GoogleAddress
464
     */
465
    public function withEstablishment(string $establishment = null)
466
    {
467
        $new = clone $this;
468
        $new->establishment = $establishment;
469
470
        return $new;
471
    }
472
473
    /**
474
     * @return AdminLevelCollection
475
     */
476
    public function getSubLocalityLevels()
477
    {
478
        return $this->subLocalityLevels;
479
    }
480
481
    /**
482
     * @param array $subLocalityLevel
483
     *
484
     * @return $this
485
     */
486
    public function withSubLocalityLevels(array $subLocalityLevel)
487
    {
488
        $subLocalityLevels = [];
489
        foreach ($subLocalityLevel as $level) {
490
            if (empty($level['level'])) {
491
                continue;
492
            }
493
494
            $name = $level['name'] ?? $level['code'] ?? null;
495
            if (empty($name)) {
496
                continue;
497
            }
498
499
            $subLocalityLevels[] = new AdminLevel($level['level'], $name, $level['code'] ?? null);
500
        }
501
502
        $new = clone $this;
503
        $new->subLocalityLevels = new AdminLevelCollection($subLocalityLevels);
504
505
        return $new;
506
    }
507
}
508