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 — map-manager-relation ( ddc93b )
by Eric
02:26
created

Map::hasMapOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
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;
13
14
use Ivory\GoogleMap\Base\Bound;
15
use Ivory\GoogleMap\Base\Coordinate;
16
use Ivory\GoogleMap\Control\ControlManager;
17
use Ivory\GoogleMap\Event\EventManager;
18
use Ivory\GoogleMap\Layer\LayerManager;
19
use Ivory\GoogleMap\Overlay\OverlayManager;
20
use Ivory\GoogleMap\Utility\VariableAwareInterface;
21
use Ivory\GoogleMap\Utility\VariableAwareTrait;
22
23
/**
24
 * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#Map
25
 *
26
 * @author GeLo <[email protected]>
27
 */
28
class Map implements VariableAwareInterface
29
{
30
    use VariableAwareTrait;
31
32
    /**
33
     * @var string
34
     */
35
    private $htmlId = 'map_canvas';
36
37
    /**
38
     * @var bool
39
     */
40
    private $autoZoom = false;
41
42
    /**
43
     * @var Coordinate
44
     */
45
    private $center;
46
47
    /**
48
     * @var Bound
49
     */
50
    private $bound;
51
52
    /**
53
     * @var ControlManager
54
     */
55
    private $controlManager;
56
57
    /**
58
     * @var EventManager
59
     */
60
    private $eventManager;
61
62
    /**
63
     * @var LayerManager
64
     */
65
    private $layerManager;
66
67
    /**
68
     * @var OverlayManager
69
     */
70
    private $overlayManager;
71
72
    /**
73
     * @var string[]
74
     */
75
    private $libraries = [];
76
77
    /**
78
     * @var mixed[]
79
     */
80
    private $mapOptions = [];
81
82
    /**
83
     * @var string[]
84
     */
85
    private $stylesheetOptions = [];
86
87
    public function __construct()
88
    {
89
        $this->setVariablePrefix('map');
90
        $this->setCenter(new Coordinate());
91
        $this->setBound(new Bound());
92
        $this->setControlManager(new ControlManager());
93
        $this->setEventManager(new EventManager());
94
        $this->setOverlayManager(new OverlayManager());
95
        $this->setLayerManager(new LayerManager());
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getHtmlId()
102
    {
103
        return $this->htmlId;
104
    }
105
106
    /**
107
     * @param string $htmlId
108
     */
109
    public function setHtmlId($htmlId)
110
    {
111
        $this->htmlId = $htmlId;
112
    }
113
114
    /**
115
     * @return bool
116
     */
117
    public function isAutoZoom()
118
    {
119
        return $this->autoZoom;
120
    }
121
122
    /**
123
     * @param bool $autoZoom
124
     */
125
    public function setAutoZoom($autoZoom)
126
    {
127
        $this->autoZoom = $autoZoom;
128
    }
129
130
    /**
131
     * @return Coordinate
132
     */
133
    public function getCenter()
134
    {
135
        return $this->center;
136
    }
137
138
    /**
139
     * @param Coordinate $center
140
     */
141
    public function setCenter(Coordinate $center)
142
    {
143
        $this->center = $center;
144
    }
145
146
    /**
147
     * @return Bound
148
     */
149
    public function getBound()
150
    {
151
        return $this->bound;
152
    }
153
154
    /**
155
     * @param Bound $bound
156
     */
157
    public function setBound(Bound $bound)
158
    {
159
        $this->bound = $bound;
160
    }
161
162
    /**
163
     * @return ControlManager
164
     */
165
    public function getControlManager()
166
    {
167
        return $this->controlManager;
168
    }
169
170
    /**
171
     * @param ControlManager $controlManager
172
     */
173
    public function setControlManager(ControlManager $controlManager)
174
    {
175
        $this->controlManager = $controlManager;
176
    }
177
178
    /**
179
     * @return EventManager
180
     */
181
    public function getEventManager()
182
    {
183
        return $this->eventManager;
184
    }
185
186
    /**
187
     * @param EventManager $eventManager
188
     */
189
    public function setEventManager(EventManager $eventManager)
190
    {
191
        $this->eventManager = $eventManager;
192
    }
193
194
    /**
195
     * @return LayerManager
196
     */
197
    public function getLayerManager()
198
    {
199
        return $this->layerManager;
200
    }
201
202
    /**
203
     * @param LayerManager $layerManager
204
     */
205
    public function setLayerManager(LayerManager $layerManager)
206
    {
207
        $this->layerManager = $layerManager;
208
    }
209
210
    /**
211
     * @return OverlayManager
212
     */
213
    public function getOverlayManager()
214
    {
215
        return $this->overlayManager;
216
    }
217
218
    /**
219
     * @param OverlayManager $overlayManager
220
     */
221
    public function setOverlayManager(OverlayManager $overlayManager)
222
    {
223
        $this->overlayManager = $overlayManager;
224
225
        if ($overlayManager->getMap() !== $this) {
226
            $overlayManager->setMap($this);
227
        }
228
    }
229
230
    /**
231
     * @return bool
232
     */
233
    public function hasLibraries()
234
    {
235
        return !empty($this->libraries);
236
    }
237
238
    /**
239
     * @return string[]
240
     */
241
    public function getLibraries()
242
    {
243
        return $this->libraries;
244
    }
245
246
    /**
247
     * @param string[] $libraries
248
     */
249
    public function setLibraries(array $libraries)
250
    {
251
        $this->libraries = [];
252
        $this->addLibraries($libraries);
253
    }
254
255
    /**
256
     * @param string[] $libraries
257
     */
258
    public function addLibraries(array $libraries)
259
    {
260
        foreach ($libraries as $library) {
261
            $this->addLibrary($library);
262
        }
263
    }
264
265
    /**
266
     * @param string $library
267
     *
268
     * @return bool
269
     */
270
    public function hasLibrary($library)
271
    {
272
        return in_array($library, $this->libraries, true);
273
    }
274
275
    /**
276
     * @param string $library
277
     */
278
    public function addLibrary($library)
279
    {
280
        if (!$this->hasLibrary($library)) {
281
            $this->libraries[] = $library;
282
        }
283
    }
284
285
    /**
286
     * @param string $library
287
     */
288
    public function removeLibrary($library)
289
    {
290
        unset($this->libraries[array_search($library, $this->libraries, true)]);
291
    }
292
293
    /**
294
     * @return bool
295
     */
296
    public function hasMapOptions()
297
    {
298
        return !empty($this->mapOptions);
299
    }
300
301
    /**
302
     * @return mixed[]
303
     */
304
    public function getMapOptions()
305
    {
306
        return $this->mapOptions;
307
    }
308
309
    /**
310
     * @param mixed[] $mapOptions
311
     */
312
    public function setMapOptions(array $mapOptions)
313
    {
314
        $this->mapOptions = [];
315
        $this->addMapOptions($mapOptions);
316
    }
317
318
    /**
319
     * @param mixed[] $mapOptions
320
     */
321
    public function addMapOptions(array $mapOptions)
322
    {
323
        foreach ($mapOptions as $mapOption => $value) {
324
            $this->setMapOption($mapOption, $value);
325
        }
326
    }
327
328
    /**
329
     * @param string $mapOption
330
     *
331
     * @return bool
332
     */
333
    public function hasMapOption($mapOption)
334
    {
335
        return isset($this->mapOptions[$mapOption]);
336
    }
337
338
    /**
339
     * @param string $mapOption
340
     *
341
     * @return mixed
342
     */
343
    public function getMapOption($mapOption)
344
    {
345
        return $this->hasMapOption($mapOption) ? $this->mapOptions[$mapOption] : null;
346
    }
347
348
    /**
349
     * @param string $mapOption
350
     * @param mixed  $value
351
     */
352
    public function setMapOption($mapOption, $value)
353
    {
354
        $this->mapOptions[$mapOption] = $value;
355
    }
356
357
    /**
358
     * @param string $mapOption
359
     */
360
    public function removeMapOption($mapOption)
361
    {
362
        unset($this->mapOptions[$mapOption]);
363
    }
364
365
    /**
366
     * @return bool
367
     */
368
    public function hasStylesheetOptions()
369
    {
370
        return !empty($this->stylesheetOptions);
371
    }
372
373
    /**
374
     * @return string[]
375
     */
376
    public function getStylesheetOptions()
377
    {
378
        return $this->stylesheetOptions;
379
    }
380
381
    /**
382
     * @param string[] $stylesheetOptions
383
     */
384
    public function setStylesheetOptions(array $stylesheetOptions)
385
    {
386
        $this->stylesheetOptions = [];
387
        $this->addStylesheetOptions($stylesheetOptions);
388
    }
389
390
    /**
391
     * @param string[] $stylesheetOptions
392
     */
393
    public function addStylesheetOptions(array $stylesheetOptions)
394
    {
395
        foreach ($stylesheetOptions as $stylesheetOption => $value) {
396
            $this->setStylesheetOption($stylesheetOption, $value);
397
        }
398
    }
399
400
    /**
401
     * @param string $stylesheetOption
402
     *
403
     * @return bool
404
     */
405
    public function hasStylesheetOption($stylesheetOption)
406
    {
407
        return isset($this->stylesheetOptions[$stylesheetOption]);
408
    }
409
410
    /**
411
     * @param string $stylesheetOption
412
     *
413
     * @return string|null
414
     */
415
    public function getStylesheetOption($stylesheetOption)
416
    {
417
        return $this->hasStylesheetOption($stylesheetOption) ? $this->stylesheetOptions[$stylesheetOption] : null;
418
    }
419
420
    /**
421
     * @param string $stylesheetOption
422
     * @param string $value
423
     */
424
    public function setStylesheetOption($stylesheetOption, $value)
425
    {
426
        $this->stylesheetOptions[$stylesheetOption] = $value;
427
    }
428
429
    /**
430
     * @param string $stylesheetOption
431
     */
432
    public function removeStylesheetOption($stylesheetOption)
433
    {
434
        unset($this->stylesheetOptions[$stylesheetOption]);
435
    }
436
}
437