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 — geocoder-place-id ( e8e706 )
by Eric
03:29 queued 01:07
created

GeocoderResult::setPlaceId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
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\Geocoder;
13
14
/**
15
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#GeocoderResult
16
 *
17
 * @author GeLo <[email protected]>
18
 */
19
class GeocoderResult
20
{
21
    /**
22
     * @var string|null
23
     */
24
    private $placeId;
25
26
    /**
27
     * @var GeocoderAddressComponent[]
28
     */
29
    private $addressComponents = [];
30
31
    /**
32
     * @var string|null
33
     */
34
    private $formattedAddress;
35
36
    /**
37
     * @var GeocoderGeometry|null
38
     */
39
    private $geometry;
40
41
    /**
42
     * @var bool|null
43
     */
44
    private $partialMatch;
45
46
    /**
47
     * @var string[]
48
     */
49
    private $types = [];
50
51
    /**
52
     * @return bool
53
     */
54
    public function hasPlaceId()
55
    {
56
        return $this->placeId !== null;
57
    }
58
59
    /**
60
     * @return string|null
61
     */
62
    public function getPlaceId()
63
    {
64
        return $this->placeId;
65
    }
66
67
    /**
68
     * @param string|null $placeId
69
     */
70
    public function setPlaceId($placeId)
71
    {
72
        $this->placeId = $placeId;
73
    }
74
75
    /**
76
     * @param string|null $type
77
     *
78
     * @return bool
79
     */
80
    public function hasAddressComponents($type = null)
81
    {
82
        $addressComponents = $this->getAddressComponents($type);
83
84
        return !empty($addressComponents);
85
    }
86
87
    /**
88
     * @param string|null $type
89
     *
90
     * @return GeocoderAddressComponent[]
91
     */
92
    public function getAddressComponents($type = null)
93
    {
94
        if ($type === null) {
95
            return $this->addressComponents;
96
        }
97
98
        $addressComponents = [];
99
100
        foreach ($this->addressComponents as $addressComponent) {
101
            if (in_array($type, $addressComponent->getTypes(), true)) {
102
                $addressComponents[] = $addressComponent;
103
            }
104
        }
105
106
        return $addressComponents;
107
    }
108
109
    /**
110
     * @param GeocoderAddressComponent[] $addressComponents
111
     */
112
    public function setAddressComponents(array $addressComponents)
113
    {
114
        $this->addressComponents = [];
115
        $this->addAddressComponents($addressComponents);
116
    }
117
118
    /**
119
     * @param GeocoderAddressComponent[] $addressComponents
120
     */
121
    public function addAddressComponents(array $addressComponents)
122
    {
123
        foreach ($addressComponents as $addressComponent) {
124
            $this->addAddressComponent($addressComponent);
125
        }
126
    }
127
128
    /**
129
     * @param GeocoderAddressComponent $addressComponent
130
     *
131
     * @return bool
132
     */
133
    public function hasAddressComponent(GeocoderAddressComponent $addressComponent)
134
    {
135
        return in_array($addressComponent, $this->addressComponents, true);
136
    }
137
138
    /**
139
     * @param GeocoderAddressComponent $addressComponent
140
     */
141
    public function addAddressComponent(GeocoderAddressComponent $addressComponent)
142
    {
143
        if (!$this->hasAddressComponent($addressComponent)) {
144
            $this->addressComponents[] = $addressComponent;
145
        }
146
    }
147
148
    /**
149
     * @param GeocoderAddressComponent $addressComponent
150
     */
151
    public function removeAddressComponent(GeocoderAddressComponent $addressComponent)
152
    {
153
        unset($this->addressComponents[array_search($addressComponent, $this->addressComponents, true)]);
154
        $this->addressComponents = array_values($this->addressComponents);
155
    }
156
157
    /**
158
     * @return bool
159
     */
160
    public function hasFormattedAddress()
161
    {
162
        return !empty($this->formattedAddress);
163
    }
164
165
    /**
166
     * @return string|null
167
     */
168
    public function getFormattedAddress()
169
    {
170
        return $this->formattedAddress;
171
    }
172
173
    /**
174
     * @param string|null $formattedAddress
175
     */
176
    public function setFormattedAddress($formattedAddress = null)
177
    {
178
        $this->formattedAddress = $formattedAddress;
179
    }
180
181
    /**
182
     * @return bool
183
     */
184
    public function hasGeometry()
185
    {
186
        return $this->geometry !== null;
187
    }
188
189
    /**
190
     * @return GeocoderGeometry|null
191
     */
192
    public function getGeometry()
193
    {
194
        return $this->geometry;
195
    }
196
197
    /**
198
     * @param GeocoderGeometry|null $geometry
199
     */
200
    public function setGeometry(GeocoderGeometry $geometry = null)
201
    {
202
        $this->geometry = $geometry;
203
    }
204
205
    /**
206
     * @return bool
207
     */
208
    public function hasPartialMatch()
209
    {
210
        return $this->partialMatch !== null;
211
    }
212
213
    /**
214
     * @return bool
215
     */
216
    public function isPartialMatch()
217
    {
218
        return $this->partialMatch;
219
    }
220
221
    /**
222
     * @param bool|null $partialMatch
223
     */
224
    public function setPartialMatch($partialMatch = null)
225
    {
226
        $this->partialMatch = $partialMatch;
227
    }
228
229
    /**
230
     * @return bool
231
     */
232
    public function hasTypes()
233
    {
234
        return !empty($this->types);
235
    }
236
237
    /**
238
     * @return string[]
239
     */
240
    public function getTypes()
241
    {
242
        return $this->types;
243
    }
244
245
    /**
246
     * @param string[] $types
247
     */
248
    public function setTypes(array $types)
249
    {
250
        $this->types = [];
251
        $this->addTypes($types);
252
    }
253
254
    /**
255
     * @param string[] $types
256
     */
257
    public function addTypes(array $types)
258
    {
259
        foreach ($types as $type) {
260
            $this->addType($type);
261
        }
262
    }
263
264
    /**
265
     * @param string $type
266
     *
267
     * @return bool
268
     */
269
    public function hasType($type)
270
    {
271
        return in_array($type, $this->types, true);
272
    }
273
274
    /**
275
     * @param string $type
276
     */
277
    public function addType($type)
278
    {
279
        if (!$this->hasType($type)) {
280
            $this->types[] = $type;
281
        }
282
    }
283
284
    /**
285
     * @param string $type
286
     */
287
    public function removeType($type)
288
    {
289
        unset($this->types[array_search($type, $this->types, true)]);
290
        $this->types = array_values($this->types);
291
    }
292
}
293