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.

Map::getOverlayManager()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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