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 ( aa3a17 )
by Eric
02:27
created

Autocomplete::hasComponents()   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 0
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\Place;
13
14
use Ivory\GoogleMap\Base\Bound;
15
use Ivory\GoogleMap\Event\EventManager;
16
use Ivory\GoogleMap\Utility\VariableAwareInterface;
17
use Ivory\GoogleMap\Utility\VariableAwareTrait;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class Autocomplete implements VariableAwareInterface
23
{
24
    use VariableAwareTrait;
25
26
    /**
27
     * @var string
28
     */
29
    private $inputId = 'place_input';
30
31
    /**
32
     * @var EventManager
33
     */
34
    private $eventManager;
35
36
    /**
37
     * @var Bound|null
38
     */
39
    private $bound;
40
41
    /**
42
     * @var string[]
43
     */
44
    private $types = [];
45
46
    /**
47
     * @var mixed[]
48
     */
49
    private $components = [];
50
51
    /**
52
     * @var string
53
     */
54
    private $value;
55
56
    /**
57
     * @var string[]
58
     */
59
    private $inputAttributes = [];
60
61
    /**
62
     * @var string[]
63
     */
64
    private $libraries = [];
65
66
    public function __construct()
67
    {
68
        $this->setVariablePrefix('place_autocomplete');
69
        $this->setEventManager(new EventManager());
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getHtmlId()
76
    {
77
        return $this->inputId;
78
    }
79
80
    /**
81
     * @param string $inputId
82
     */
83
    public function setInputId($inputId)
84
    {
85
        $this->inputId = $inputId;
86
    }
87
88
    /**
89
     * @return EventManager
90
     */
91
    public function getEventManager()
92
    {
93
        return $this->eventManager;
94
    }
95
96
    /**
97
     * @param EventManager $eventManager
98
     */
99
    public function setEventManager(EventManager $eventManager)
100
    {
101
        $this->eventManager = $eventManager;
102
    }
103
104
    /**
105
     * @return bool
106
     */
107
    public function hasBound()
108
    {
109
        return $this->bound !== null;
110
    }
111
112
    /**
113
     * @return Bound|null
114
     */
115
    public function getBound()
116
    {
117
        return $this->bound;
118
    }
119
120
    /**
121
     * @param Bound|null $bound
122
     */
123
    public function setBound(Bound $bound = null)
124
    {
125
        $this->bound = $bound;
126
    }
127
128
    /**
129
     * @return bool
130
     */
131
    public function hasTypes()
132
    {
133
        return !empty($this->types);
134
    }
135
136
    /**
137
     * @return string[]
138
     */
139
    public function getTypes()
140
    {
141
        return $this->types;
142
    }
143
144
    /**
145
     * @param string[] $types
146
     */
147
    public function setTypes(array $types)
148
    {
149
        $this->types = [];
150
        $this->addTypes($types);
151
    }
152
153
    /**
154
     * @param string[] $types
155
     */
156
    public function addTypes(array $types)
157
    {
158
        foreach ($types as $type) {
159
            $this->addType($type);
160
        }
161
    }
162
163
    /**
164
     * @param string $type
165
     *
166
     * @return bool
167
     */
168
    public function hasType($type)
169
    {
170
        return in_array($type, $this->types, true);
171
    }
172
173
    /**
174
     * @param string $type
175
     */
176
    public function addType($type)
177
    {
178
        if (!$this->hasType($type)) {
179
            $this->types[] = $type;
180
        }
181
    }
182
183
    /**
184
     * @param string $type
185
     */
186
    public function removeType($type)
187
    {
188
        unset($this->types[array_search($type, $this->types, true)]);
189
    }
190
191
    /**
192
     * @return bool
193
     */
194
    public function hasComponents()
195
    {
196
        return !empty($this->components);
197
    }
198
199
    /**
200
     * @return mixed[]
201
     */
202
    public function getComponents()
203
    {
204
        return $this->components;
205
    }
206
207
    /**
208
     * @param mixed[] $components
209
     */
210
    public function setComponents(array $components)
211
    {
212
        $this->components = [];
213
        $this->addComponents($components);
214
    }
215
216
    /**
217
     * @param mixed[] $componentRestrictions
218
     */
219
    public function addComponents(array $componentRestrictions)
220
    {
221
        foreach ($componentRestrictions as $type => $value) {
222
            $this->setComponent($type, $value);
223
        }
224
    }
225
226
    /**
227
     * @param string $type
228
     *
229
     * @return bool
230
     */
231
    public function hasComponent($type)
232
    {
233
        return isset($this->components[$type]);
234
    }
235
236
    /**
237
     * @param string $type
238
     *
239
     * @return mixed
240
     */
241
    public function getComponent($type)
242
    {
243
        return $this->hasComponent($type) ? $this->components[$type] : null;
244
    }
245
246
    /**
247
     * @param string $type
248
     * @param mixed  $value
249
     */
250
    public function setComponent($type, $value)
251
    {
252
        $this->components[$type] = $value;
253
    }
254
255
    /**
256
     * @param string $type
257
     */
258
    public function removeComponent($type)
259
    {
260
        unset($this->components[$type]);
261
    }
262
263
    /**
264
     * @return bool
265
     */
266
    public function hasValue()
267
    {
268
        return $this->value !== null;
269
    }
270
271
    /**
272
     * @return string|null
273
     */
274
    public function getValue()
275
    {
276
        return $this->value;
277
    }
278
279
    /**
280
     * @param string|null $value
281
     */
282
    public function setValue($value = null)
283
    {
284
        $this->value = $value;
285
    }
286
287
    /**
288
     * @return bool
289
     */
290
    public function hasInputAttributes()
291
    {
292
        return !empty($this->inputAttributes);
293
    }
294
295
    /**
296
     * @return string[]
297
     */
298
    public function getInputAttributes()
299
    {
300
        return $this->inputAttributes;
301
    }
302
303
    /**
304
     * @param string[] $inputAttributes
305
     */
306
    public function setInputAttributes(array $inputAttributes)
307
    {
308
        $this->inputAttributes = [];
309
        $this->addInputAttributes($inputAttributes);
310
    }
311
312
    /**
313
     * @param string[] $inputAttributes
314
     */
315
    public function addInputAttributes(array $inputAttributes)
316
    {
317
        foreach ($inputAttributes as $name => $value) {
318
            $this->setInputAttribute($name, $value);
319
        }
320
    }
321
322
    /**
323
     * @param string $name
324
     *
325
     * @return bool
326
     */
327
    public function hasInputAttribute($name)
328
    {
329
        return isset($this->inputAttributes[$name]);
330
    }
331
332
    /**
333
     * @param string $name
334
     *
335
     * @return string|null
336
     */
337
    public function getInputAttribute($name)
338
    {
339
        return $this->hasInputAttribute($name) ? $this->inputAttributes[$name] : null;
340
    }
341
342
    /**
343
     * @param string $name
344
     * @param string $value
345
     */
346
    public function setInputAttribute($name, $value)
347
    {
348
        $this->inputAttributes[$name] = $value;
349
    }
350
351
    /**
352
     * @param string $name
353
     */
354
    public function removeInputAttribute($name)
355
    {
356
        unset($this->inputAttributes[$name]);
357
    }
358
359
    /**
360
     * @return bool
361
     */
362
    public function hasLibraries()
363
    {
364
        return !empty($this->libraries);
365
    }
366
367
    /**
368
     * @return string[]
369
     */
370
    public function getLibraries()
371
    {
372
        return $this->libraries;
373
    }
374
375
    /**
376
     * @param string[] $libraries
377
     */
378
    public function setLibraries(array $libraries)
379
    {
380
        $this->libraries = [];
381
        $this->addLibraries($libraries);
382
    }
383
384
    /**
385
     * @param string[] $libraries
386
     */
387
    public function addLibraries(array $libraries)
388
    {
389
        foreach ($libraries as $library) {
390
            $this->addLibrary($library);
391
        }
392
    }
393
394
    /**
395
     * @param string $library
396
     *
397
     * @return bool
398
     */
399
    public function hasLibrary($library)
400
    {
401
        return in_array($library, $this->libraries, true);
402
    }
403
404
    /**
405
     * @param string $library
406
     */
407
    public function addLibrary($library)
408
    {
409
        if (!$this->hasLibrary($library)) {
410
            $this->libraries[] = $library;
411
        }
412
    }
413
414
    /**
415
     * @param string $library
416
     */
417
    public function removeLibrary($library)
418
    {
419
        unset($this->libraries[array_search($library, $this->libraries, true)]);
420
    }
421
}
422