Completed
Push — master ( 05561b...394afc )
by Bradley
01:26
created

MapperBase::getScaleControl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
rs 10
1
<?php namespace Cornford\Googlmapper;
2
3
use Cornford\Googlmapper\Contracts\MappingBaseInterface;
4
use Cornford\Googlmapper\Exceptions\MapperArgumentException;
5
use Illuminate\View\Factory as View;
6
7
abstract class MapperBase implements MappingBaseInterface
8
{
9
10
	const ENABLED = true;
11
12
	const REGION = 'GB';
13
14
	const LANGUAGE = 'en-gb';
15
16
	const TYPE_ROADMAP = 'ROADMAP';
17
	const TYPE_SATELLITE = 'SATELLITE';
18
	const TYPE_HYBRID = 'HYBRID';
19
	const TYPE_TERRAIN = 'TERRAIN';
20
21
	const ASYNC = false;
22
23
	const USER = false;
24
25
	const MARKER = true;
26
27
	const CENTER = true;
28
29
	const LOCATE = false;
30
31
	const ZOOM = 8;
32
	const SCROLL_WHEEL_ZOOM = true;
33
34
    const CONTROL_ZOOM = true;
35
    const CONTROL_MAP_TYPE = true;
36
    const CONTROL_SCALE = false;
37
    const CONTROL_STREET_VIEW = true;
38
    const CONTROL_ROTATE = false;
39
    const CONTROL_FULLSCREEN = true;
40
41
    const HEADING = 0;
42
43
	const TILT = 0;
44
45
	const UI = true;
46
47
	const ANIMATION_NONE = 'NONE';
48
	const ANIMATION_DROP = 'DROP';
49
	const ANIMATION_BOUNCE = 'BOUNCE';
50
51
	const OVERLAY_NONE = 'NONE';
52
	const OVERLAY_BIKE = 'BIKE';
53
	const OVERLAY_TRANSIT = 'TRANSIT';
54
	const OVERLAY_TRAFFIC = 'TRAFFIC';
55
56
	const SYMBOL_CIRCLE = 'CIRCLE';
57
	const SYMBOL_BACKWARD_CLOSED_ARROW = 'BACKWARD_CLOSED_ARROW';
58
	const SYMBOL_FORWARD_CLOSED_ARROW = 'FORWARD_CLOSED_ARROW';
59
	const SYMBOL_BACKWARD_OPEN_ARROW = 'BACKWARD_OPEN_ARROW';
60
	const SYMBOL_FORWARD_OPEN_ARROW = 'FORWARD_OPEN_ARROW';
61
62
	const ICON = '';
63
64
	const CLUSTER = true;
65
66
	const CLUSTERS_ICON = '//googlemaps.github.io/js-marker-clusterer/images/m';
67
	const CLUSTERS_GRID = 60;
68
	const CLUSTERS_ZOOM = null;
69
	const CLUSTERS_CENTER = false;
70
	const CLUSTERS_SIZE = 2;
71
72
	/**
73
	 * View.
74
	 *
75
	 * @var \Illuminate\View\Factory
76
	 */
77
	protected $view;
78
79
	/**
80
	 * Mapping enabled.
81
	 *
82
	 * @var boolean
83
	 */
84
	protected $enabled;
85
86
	/**
87
	 * API Key.
88
	 *
89
	 * @var string
90
	 */
91
	protected $key;
92
93
	/**
94
	 * API Version.
95
	 *
96
	 * @var integer
97
	 */
98
	protected $version = '3.exp';
99
100
	/**
101
	 * API region.
102
	 *
103
	 * @var string
104
	 */
105
	protected $region;
106
107
	/**
108
	 * API regions.
109
	 *
110
	 * @var array
111
	 */
112
	protected $regions = [
113
		'AF',
114
		'AX',
115
		'AL',
116
		'DZ',
117
		'AS',
118
		'AD',
119
		'AO',
120
		'AI',
121
		'AQ',
122
		'AG',
123
		'AR',
124
		'AM',
125
		'AW',
126
		'AU',
127
		'AT',
128
		'AZ',
129
		'BS',
130
		'BH',
131
		'BD',
132
		'BB',
133
		'BY',
134
		'BE',
135
		'BZ',
136
		'BJ',
137
		'BM',
138
		'BT',
139
		'BO',
140
		'BQ',
141
		'BA',
142
		'BW',
143
		'BV',
144
		'BR',
145
		'IO',
146
		'BN',
147
		'BG',
148
		'BF',
149
		'BI',
150
		'KH',
151
		'CM',
152
		'CA',
153
		'CV',
154
		'KY',
155
		'CF',
156
		'TD',
157
		'CL',
158
		'CN',
159
		'CX',
160
		'CC',
161
		'CO',
162
		'KM',
163
		'CG',
164
		'CD',
165
		'CK',
166
		'CR',
167
		'CI',
168
		'HR',
169
		'CU',
170
		'CW',
171
		'CY',
172
		'CZ',
173
		'DK',
174
		'DJ',
175
		'DM',
176
		'DO',
177
		'EC',
178
		'EG',
179
		'SV',
180
		'GQ',
181
		'ER',
182
		'EE',
183
		'ET',
184
		'FK',
185
		'FO',
186
		'FJ',
187
		'FI',
188
		'FR',
189
		'GF',
190
		'PF',
191
		'TF',
192
		'GA',
193
		'GM',
194
		'GE',
195
		'DE',
196
		'GH',
197
		'GI',
198
		'GR',
199
		'GL',
200
		'GD',
201
		'GP',
202
		'GU',
203
		'GT',
204
		'GG',
205
		'GN',
206
		'GW',
207
		'GY',
208
		'HT',
209
		'HM',
210
		'VA',
211
		'HN',
212
		'HK',
213
		'HU',
214
		'IS',
215
		'IN',
216
		'ID',
217
		'IR',
218
		'IQ',
219
		'IE',
220
		'IM',
221
		'IL',
222
		'IT',
223
		'JM',
224
		'JP',
225
		'JE',
226
		'JO',
227
		'KZ',
228
		'KE',
229
		'KI',
230
		'KP',
231
		'KR',
232
		'KW',
233
		'KG',
234
		'LA',
235
		'LV',
236
		'LB',
237
		'LS',
238
		'LR',
239
		'LY',
240
		'LI',
241
		'LT',
242
		'LU',
243
		'MO',
244
		'MK',
245
		'MG',
246
		'MW',
247
		'MY',
248
		'MV',
249
		'ML',
250
		'MT',
251
		'MH',
252
		'MQ',
253
		'MR',
254
		'MU',
255
		'YT',
256
		'MX',
257
		'FM',
258
		'MD',
259
		'MC',
260
		'MN',
261
		'ME',
262
		'MS',
263
		'MA',
264
		'MZ',
265
		'MM',
266
		'NA',
267
		'NR',
268
		'NP',
269
		'NL',
270
		'NC',
271
		'NZ',
272
		'NI',
273
		'NE',
274
		'NG',
275
		'NU',
276
		'NF',
277
		'MP',
278
		'NO',
279
		'OM',
280
		'PK',
281
		'PW',
282
		'PS',
283
		'PA',
284
		'PG',
285
		'PY',
286
		'PE',
287
		'PH',
288
		'PN',
289
		'PL',
290
		'PT',
291
		'PR',
292
		'QA',
293
		'RE',
294
		'RO',
295
		'RU',
296
		'RW',
297
		'BL',
298
		'SH',
299
		'KN',
300
		'LC',
301
		'MF',
302
		'PM',
303
		'VC',
304
		'WS',
305
		'SM',
306
		'ST',
307
		'SA',
308
		'SN',
309
		'RS',
310
		'SC',
311
		'SL',
312
		'SG',
313
		'SX',
314
		'SK',
315
		'SI',
316
		'SB',
317
		'SO',
318
		'ZA',
319
		'GS',
320
		'SS',
321
		'ES',
322
		'LK',
323
		'SD',
324
		'SR',
325
		'SJ',
326
		'SZ',
327
		'SE',
328
		'CH',
329
		'SY',
330
		'TW',
331
		'TJ',
332
		'TZ',
333
		'TH',
334
		'TL',
335
		'TG',
336
		'TK',
337
		'TO',
338
		'TT',
339
		'TN',
340
		'TR',
341
		'TM',
342
		'TC',
343
		'TV',
344
		'UG',
345
		'UA',
346
		'AE',
347
		'GB',
348
		'US',
349
		'UM',
350
		'UY',
351
		'UZ',
352
		'VU',
353
		'VE',
354
		'VN',
355
		'VG',
356
		'VI',
357
		'WF',
358
		'EH',
359
		'YE',
360
		'ZM',
361
		'ZW'
362
	];
363
364
	/**
365
	 * API Language.
366
	 *
367
	 * @var string
368
	 */
369
	protected $language;
370
371
	/**
372
	 * API Languages.
373
	 *
374
	 * @var array
375
	 */
376
	protected $languages = [
377
		'af',
378
		'ar-ae',
379
		'ar-bh',
380
		'ar-dz',
381
		'ar-eg',
382
		'ar-iq',
383
		'ar-jo',
384
		'ar-kw',
385
		'ar-lb',
386
		'ar-ly',
387
		'ar-ma',
388
		'ar-om',
389
		'ar-qa',
390
		'ar-sa',
391
		'ar-sy',
392
		'ar-tn',
393
		'ar-ye',
394
		'be',
395
		'bg',
396
		'ca',
397
		'cs',
398
		'da',
399
		'de',
400
		'de-at',
401
		'de-ch',
402
		'de-li',
403
		'de-lu',
404
		'el',
405
		'en',
406
		'en-au',
407
		'en-bz',
408
		'en-ca',
409
		'en-gb',
410
		'en-ie',
411
		'en-jm',
412
		'en-nz',
413
		'en-tt',
414
		'en-us',
415
		'en-za',
416
		'es',
417
		'es-ar',
418
		'es-bo',
419
		'es-cl',
420
		'es-co',
421
		'es-cr',
422
		'es-do',
423
		'es-ec',
424
		'es-gt',
425
		'es-hn',
426
		'es-mx',
427
		'es-ni',
428
		'es-pa',
429
		'es-pe',
430
		'es-pr',
431
		'es-py',
432
		'es-sv',
433
		'es-uy',
434
		'es-ve',
435
		'et',
436
		'eu',
437
		'fa',
438
		'fi',
439
		'fo',
440
		'fr',
441
		'fr-be',
442
		'fr-ca',
443
		'fr-ch',
444
		'fr-lu',
445
		'ga',
446
		'gd',
447
		'he',
448
		'hi',
449
		'hr',
450
		'hu',
451
		'id',
452
		'is',
453
		'it',
454
		'it-ch',
455
		'ja',
456
		'ji',
457
		'ko',
458
		'ko',
459
		'ku',
460
		'lt',
461
		'lv',
462
		'mk',
463
		'ml',
464
		'ms',
465
		'mt',
466
		'nl',
467
		'nl-be',
468
		'nb',
469
		'nn',
470
		'no',
471
		'pa',
472
		'pl',
473
		'pt',
474
		'pt-br',
475
		'rm',
476
		'ro',
477
		'ro-md',
478
		'ru',
479
		'ru-md',
480
		'sb',
481
		'sk',
482
		'sl',
483
		'sq',
484
		'sr',
485
		'sv',
486
		'sv-fi',
487
		'th',
488
		'tn',
489
		'tr',
490
		'ts',
491
		'uk',
492
		'ur',
493
		've',
494
		'vi',
495
		'xh',
496
		'zh-cn',
497
		'zh-hk',
498
		'zh-sg',
499
		'zh-tw',
500
		'zu'
501
	];
502
503
	/**
504
	 * Async maps.
505
	 *
506
	 * @var boolean
507
	 */
508
	protected $async;
509
510
	/**
511
	 * User custom maps.
512
	 *
513
	 * @var boolean
514
	 */
515
	protected $user;
516
517
	/**
518
	 * Automatic map marker.
519
	 *
520
	 * @var boolean
521
	 */
522
	protected $marker;
523
524
	/**
525
	 * Center map automatically.
526
	 *
527
	 * @var boolean
528
	 */
529
	protected $center;
530
531
	/**
532
	 * Locate users location.
533
	 *
534
	 * @var boolean
535
	 */
536
	protected $locate;
537
538
	/**
539
	 * Show map UI.
540
	 *
541
	 * @var boolean
542
	 */
543
	protected $ui;
544
545
	/**
546
	 * Map zoom level.
547
	 *
548
	 * @var integer
549
	 */
550
	protected $zoom;
551
552
	/**
553
	 * Map scroll wheel zoom.
554
	 *
555
	 * @var boolean
556
	 */
557
	protected $scrollWheelZoom;
558
559
    /**
560
     * Map zoom control.
561
     *
562
     * @var boolean
563
     */
564
    protected $zoomControl;
565
566
    /**
567
     * Map type control.
568
     *
569
     * @var boolean
570
     */
571
    protected $mapTypeControl;
572
573
    /**
574
	 * Map scale control.
575
	 *
576
	 * @var boolean
577
	 */
578
	protected $scaleControl;
579
580
    /**
581
	 * Map street view control.
582
	 *
583
	 * @var boolean
584
	 */
585
	protected $streetViewControl;
586
587
    /**
588
	 * Map rotate control.
589
	 *
590
	 * @var boolean
591
	 */
592
	protected $rotateControl;
593
594
    /**
595
     * Map fullscreen control.
596
     *
597
     * @var boolean
598
     */
599
    protected $fullscreenControl;
600
601
    /**
602
	 * Map type.
603
	 *
604
	 * @var string
605
	 */
606
	protected $type;
607
608
	/**
609
	 * Available map types.
610
	 *
611
	 * @var array
612
	 */
613
	protected $types = [
614
		'ROADMAP',
615
		'SATELLITE',
616
		'HYBRID',
617
		'TERRAIN'
618
	];
619
620
    /**
621
     * Map heading.
622
     *
623
     * @var integer
624
     */
625
    protected $heading;
626
627
	/**
628
	 * Map tilt.
629
	 *
630
	 * @var integer
631
	 */
632
	protected $tilt;
633
634
	/**
635
	 * Map marker icon.
636
	 *
637
	 * @var string
638
	 */
639
	protected $icon;
640
641
	/**
642
	 * Map marker animation.
643
	 *
644
	 * @var string
645
	 */
646
	protected $animation;
647
648
	/**
649
	 * Available map marker animations.
650
	 *
651
	 * @var array
652
	 */
653
	protected $animations = [
654
		'NONE',
655
		'DROP',
656
		'BOUNCE',
657
	];
658
659
	/**
660
	 * Map marker cluster.
661
	 *
662
	 * @var boolean
663
	 */
664
	protected $cluster;
665
666
	/**
667
	 * Map marker clusters icon.
668
	 *
669
	 * @var array
670
	 */
671
	protected $clustersIcon;
672
673
	/**
674
	 * Map marker clusters grid.
675
	 *
676
	 * @var integer
677
	 */
678
	protected $clustersGrid;
679
680
	/**
681
	 * Map marker clusters zoom.
682
	 *
683
	 * @var integer|null
684
	 */
685
	protected $clustersZoom;
686
687
	/**
688
	 * Map marker clusters center.
689
	 *
690
	 * @var boolean
691
	 */
692
	protected $clustersCenter;
693
694
	/**
695
	 * Map marker clusters size.
696
	 *
697
	 * @var integer
698
	 */
699
	protected $clustersSize;
700
701
	/**
702
	 * Mapping items.
703
	 *
704
	 * @var array
705
	 */
706
	public $items = [];
707
708
	/**
709
	 * Construct Googlmapper.
710
	 *
711
	 * @param View  $view
712
	 * @param array $options
713
	 *
714
	 * @throws MapperArgumentException
715
	 */
716
	public function __construct(View $view, array $options = [])
717
	{
718
		$this->view = $view;
719
720
		if (!isset($options['key'])) {
721
			throw new MapperArgumentException('Google maps API key is required.');
722
		}
723
724
		if (!isset($options['region'])) {
725
			throw new MapperArgumentException('Region is required.');
726
		}
727
728
		if (!in_array($options['region'], $this->regions)) {
729
			throw new MapperArgumentException('Region is required in ISO 3166-1 code format.');
730
		}
731
732
		if (!isset($options['language']) || !in_array($options['language'], $this->languages)) {
733
			throw new MapperArgumentException('Language is required.');
734
		}
735
736
		if (!in_array($options['language'], $this->languages)) {
737
			throw new MapperArgumentException('Language is required in ISO 639-1 code format.');
738
		}
739
740
		$this->setEnabled(isset($options['enabled']) ? $options['enabled'] : self::ENABLED);
741
		$this->setKey($options['key']);
742
		$this->setRegion(isset($options['region']) ? $options['region'] : self::REGION);
743
		$this->setLanguage(isset($options['language']) ? $options['language'] : self::LANGUAGE);
744
		$this->setUser(isset($options['user']) ? $options['user'] : self::USER);
745
		$this->setAsync(isset($options['async']) ? $options['async'] : self::ASYNC);
746
		$this->setMarker(isset($options['marker']) ? $options['marker'] : self::MARKER);
747
		$this->setCenter(isset($options['center']) ? $options['center'] : self::CENTER);
748
		$this->setLocate(isset($options['locate']) ? $options['locate'] : self::LOCATE);
749
		$this->setZoom(isset($options['zoom']) ? $options['zoom'] : self::ZOOM);
750
		$this->setScrollWheelZoom(isset($options['scrollWheelZoom']) ? $options['scrollWheelZoom'] : self::SCROLL_WHEEL_ZOOM);
751
        $this->setZoomControl(isset($options['zoomControl']) ? $options['zoomControl'] : self::CONTROL_ZOOM);
752
        $this->setMapTypeControl(isset($options['mapTypeControl']) ? $options['mapTypeControl'] : self::CONTROL_MAP_TYPE);
753
        $this->setScaleControl(isset($options['scaleControl']) ? $options['scaleControl'] : self::CONTROL_SCALE);
754
        $this->setStreetViewControl(isset($options['streetViewControl']) ? $options['streetViewControl'] : self::CONTROL_STREET_VIEW);
755
        $this->setRotateControl(isset($options['rotateControl']) ? $options['rotateControl'] : self::CONTROL_ROTATE);
756
        $this->setFullscreenControl(isset($options['fullscreenControl']) ? $options['fullscreenControl'] : self::CONTROL_FULLSCREEN);
757
        $this->setType(isset($options['type']) ? $options['type'] : self::TYPE_ROADMAP);
758
		$this->setHeading(isset($options['heading']) ? $options['heading'] : self::HEADING);
759
		$this->setTilt(isset($options['tilt']) ? $options['tilt'] : self::TILT);
760
		$this->setUi(isset($options['ui']) ? $options['ui'] : self::UI);
761
		$this->setIcon(isset($options['markers']['icon']) ? $options['markers']['icon'] : self::ICON);
762
		$this->setAnimation(isset($options['markers']['animation']) ? $options['markers']['animation'] : self::ANIMATION_NONE);
763
		$this->setCluster(isset($options['cluster']) ? $options['cluster'] : self::CLUSTER);
764
		$this->setClustersIcon(isset($options['clusters']['icon']) ? $options['clusters']['icon'] : self::CLUSTERS_ICON);
765
		$this->setClustersGrid(isset($options['clusters']['grid']) ? $options['clusters']['grid'] : self::CLUSTERS_GRID);
766
		$this->setClustersZoom(isset($options['clusters']['zoom']) ? $options['clusters']['zoom'] : self::CLUSTERS_ZOOM);
767
		$this->setClustersCenter(isset($options['clusters']['center']) ? $options['clusters']['center'] : self::CLUSTERS_CENTER);
768
		$this->setClustersSize(isset($options['clusters']['size']) ? $options['clusters']['size'] : self::CLUSTERS_SIZE);
769
	}
770
771
	/**
772
	 * Is mapping enabled?
773
	 *
774
	 * @return boolean
775
	 */
776
	public function isEnabled()
777
	{
778
		return $this->getEnabled();
779
	}
780
781
	/**
782
	 * Set enabled status.
783
	 *
784
	 * @param boolean $value
785
	 *
786
	 * @throws MapperArgumentException
787
	 *
788
	 * @return void
789
	 */
790
	protected function setEnabled($value)
791
	{
792
		if (!is_bool($value)) {
793
			throw new MapperArgumentException('Invalid map enabled setting.');
794
		}
795
796
		$this->enabled = $value;
797
	}
798
799
	/**
800
	 * Get the enabled status.
801
	 *
802
	 * @return boolean
803
	 */
804
	protected function getEnabled()
805
	{
806
		return $this->enabled;
807
	}
808
809
	/**
810
	 * Enable mapping.
811
	 *
812
	 * @return void
813
	 */
814
	public function enableMapping()
815
	{
816
		$this->setEnabled(true);
817
	}
818
819
	/**
820
	 * Disable mapping.
821
	 *
822
	 * @return void
823
	 */
824
	public function disableMapping()
825
	{
826
		$this->setEnabled(false);
827
	}
828
829
	/**
830
	 * Set the Google Maps key.
831
	 *
832
	 * @param string $value
833
	 *
834
	 * @throws MapperArgumentException
835
	 *
836
	 * @return void
837
	 */
838
	public function setKey($value)
839
	{
840
		if (!is_string($value)) {
841
			throw new MapperArgumentException('Invalid Google Map\'s API key.');
842
		}
843
844
		$this->key = $value;
845
	}
846
847
	/**
848
	 * Get the Google Maps key.
849
	 *
850
	 * @return string
851
	 */
852
	public function getKey()
853
	{
854
		return $this->key;
855
	}
856
857
	/**
858
	 * Set the Google Maps region.
859
	 *
860
	 * @param string $value
861
	 *
862
	 * @throws MapperArgumentException
863
	 *
864
	 * @return void
865
	 */
866 View Code Duplication
	public function setRegion($value)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
867
	{
868
		if (!is_string($value)) {
869
			throw new MapperArgumentException('Invalid map region.');
870
		}
871
872
		if (!in_array($value, $this->regions)) {
873
			throw new MapperArgumentException('Region is required in ISO 3166-1 code format.');
874
		}
875
876
		$this->region = $value;
877
	}
878
879
	/**
880
	 * Get the Google Maps region.
881
	 *
882
	 * @return string
883
	 */
884
	public function getRegion()
885
	{
886
		return $this->region;
887
	}
888
889
	/**
890
	 * Set the Google Maps language.
891
	 *
892
	 * @param string $value
893
	 *
894
	 * @throws MapperArgumentException
895
	 *
896
	 * @return void
897
	 */
898 View Code Duplication
	public function setLanguage($value)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
899
	{
900
		if (!is_string($value)) {
901
			throw new MapperArgumentException('Invalid map language.');
902
		}
903
904
		if (!in_array($value, $this->languages)) {
905
			throw new MapperArgumentException('Language is required in ISO 639-1 code format.');
906
		}
907
908
		$this->language = $value;
909
	}
910
911
	/**
912
	 * Get the Google Maps language.
913
	 *
914
	 * @return string
915
	 */
916
	public function getLanguage()
917
	{
918
		return $this->language;
919
	}
920
921
    /**
922
     * Set the map async status.
923
     *
924
     * @param boolean $value
925
     *
926
     * @throws MapperArgumentException
927
     *
928
     * @return void
929
     */
930
    protected function setAsync($value)
931
    {
932
        if (!is_bool($value)) {
933
            throw new MapperArgumentException('Invalid map async status.');
934
        }
935
936
        $this->async = $value;
937
    }
938
939
    /**
940
     * Get the map async status.
941
     *
942
     * @return boolean
943
     */
944
    public function getAsync()
945
    {
946
        return $this->async;
947
    }
948
949
    /**
950
     * Enable async for maps.
951
     *
952
     * @return void
953
     */
954
    public function enableAsync()
955
    {
956
        $this->setAsync(true);
957
    }
958
959
    /**
960
     * Disable async for maps.
961
     *
962
     * @return void
963
     */
964
    public function disableAsync()
965
    {
966
        $this->setAsync(false);
967
    }
968
969
	/**
970
	 * Set the map user status.
971
	 *
972
	 * @param boolean $value
973
	 *
974
	 * @throws MapperArgumentException
975
	 *
976
	 * @return void
977
	 */
978
	protected function setUser($value)
979
	{
980
		if (!is_bool($value)) {
981
			throw new MapperArgumentException('Invalid map user status.');
982
		}
983
984
		$this->user = $value;
985
	}
986
987
	/**
988
	 * Get the map user status.
989
	 *
990
	 * @return boolean
991
	 */
992
	public function getUser()
993
	{
994
		return $this->user;
995
	}
996
997
	/**
998
	 * Enable users for maps.
999
	 *
1000
	 * @return void
1001
	 */
1002
	public function enableUsers()
1003
	{
1004
		$this->setUser(true);
1005
	}
1006
1007
	/**
1008
	 * Disable users for maps.
1009
	 *
1010
	 * @return void
1011
	 */
1012
	public function disableUsers()
1013
	{
1014
		$this->setUser(false);
1015
	}
1016
1017
	/**
1018
	 * Set the marker status.
1019
	 *
1020
	 * @param boolean $value
1021
	 *
1022
	 * @throws MapperArgumentException
1023
	 *
1024
	 * @return void
1025
	 */
1026
	protected function setMarker($value)
1027
	{
1028
		if (!is_bool($value)) {
1029
			throw new MapperArgumentException('Invalid map marker setting.');
1030
		}
1031
1032
		$this->marker = $value;
1033
	}
1034
1035
	/**
1036
	 * Get the marker status.
1037
	 *
1038
	 * @return boolean
1039
	 */
1040
	public function getMarker()
1041
	{
1042
		return $this->marker;
1043
	}
1044
1045
	/**
1046
	 * Enable markers for maps.
1047
	 *
1048
	 * @return void
1049
	 */
1050
	public function enableMarkers()
1051
	{
1052
		$this->setMarker(true);
1053
	}
1054
1055
	/**
1056
	 * Disable markers for maps.
1057
	 *
1058
	 * @return void
1059
	 */
1060
	public function disableMarkers()
1061
	{
1062
		$this->setMarker(false);
1063
	}
1064
1065
	/**
1066
	 * Set the map center status.
1067
	 *
1068
	 * @param boolean $value
1069
	 *
1070
	 * @throws MapperArgumentException
1071
	 *
1072
	 * @return void
1073
	 */
1074
	protected function setCenter($value)
1075
	{
1076
		if (!is_bool($value)) {
1077
			throw new MapperArgumentException('Invalid map center setting.');
1078
		}
1079
1080
		$this->center = $value;
1081
	}
1082
1083
	/**
1084
	 * Get the map center status.
1085
	 *
1086
	 * @return boolean
1087
	 */
1088
	public function getCenter()
1089
	{
1090
		return $this->center;
1091
	}
1092
1093
	/**
1094
	 * Enable center of maps.
1095
	 *
1096
	 * @return void
1097
	 */
1098
	public function enableCenter()
1099
	{
1100
		$this->setCenter(true);
1101
	}
1102
1103
	/**
1104
	 * Disable center of maps.
1105
	 *
1106
	 * @return void
1107
	 */
1108
	public function disableCenter()
1109
	{
1110
		$this->setCenter(false);
1111
	}
1112
1113
	/**
1114
	 * Set the map locate user status.
1115
	 *
1116
	 * @param boolean $value
1117
	 *
1118
	 * @throws MapperArgumentException
1119
	 *
1120
	 * @return void
1121
	 */
1122
	protected function setLocate($value)
1123
	{
1124
		if (!is_bool($value)) {
1125
			throw new MapperArgumentException('Invalid map locate setting.');
1126
		}
1127
1128
		$this->locate = $value;
1129
	}
1130
1131
	/**
1132
	 * Get the map locate user status.
1133
	 *
1134
	 * @return boolean
1135
	 */
1136
	public function getLocate()
1137
	{
1138
		return $this->locate;
1139
	}
1140
1141
	/**
1142
	 * Enable locate user position on maps.
1143
	 *
1144
	 * @return void
1145
	 */
1146
	public function enableLocate()
1147
	{
1148
		$this->setLocate(true);
1149
	}
1150
1151
	/**
1152
	 * Disable locate user position on maps.
1153
	 *
1154
	 * @return void
1155
	 */
1156
	public function disableLocate()
1157
	{
1158
		$this->setLocate(false);
1159
	}
1160
1161
	/**
1162
	 * Set the map UI status.
1163
	 *
1164
	 * @param boolean $value
1165
	 *
1166
	 * @throws MapperArgumentException
1167
	 *
1168
	 * @return void
1169
	 */
1170
	protected function setUi($value)
1171
	{
1172
		if (!is_bool($value)) {
1173
			throw new MapperArgumentException('Invalid map ui setting.');
1174
		}
1175
1176
		$this->ui = $value;
1177
	}
1178
1179
	/**
1180
	 * Get the map UI status.
1181
	 *
1182
	 * @return boolean
1183
	 */
1184
	public function getUi()
1185
	{
1186
		return $this->ui;
1187
	}
1188
1189
	/**
1190
	 * Enable maps ui.
1191
	 *
1192
	 * @return void
1193
	 */
1194
	public function enableUi()
1195
	{
1196
		$this->setUi(false);
1197
	}
1198
1199
	/**
1200
	 * Disable maps ui.
1201
	 *
1202
	 * @return void
1203
	 */
1204
	public function disableUi()
1205
	{
1206
		$this->setUi(true);
1207
	}
1208
1209
	/**
1210
	 * Set map zoom level.
1211
	 *
1212
	 * @param integer $value
1213
	 *
1214
	 * @throws MapperArgumentException
1215
	 *
1216
	 * @return void
1217
	 */
1218
	public function setZoom($value)
1219
	{
1220
		if (!is_numeric($value)) {
1221
			throw new MapperArgumentException('Zoom level must be an integer.');
1222
		}
1223
1224
		if ($value < 1 || $value > 20) {
1225
			throw new MapperArgumentException('A zoom level must be between 1 and 20.');
1226
		}
1227
1228
		$this->zoom = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value can also be of type double or string. However, the property $zoom is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
1229
	}
1230
1231
	/**
1232
	 * Get map zoom level.
1233
	 *
1234
	 * @return integer
1235
	 */
1236
	public function getZoom()
1237
	{
1238
		return $this->zoom;
1239
	}
1240
1241
	/**
1242
	 * Set map scroll wheel zoom.
1243
	 *
1244
	 * @param boolean $value
1245
	 *
1246
	 * @throws MapperArgumentException
1247
	 *
1248
	 * @return void
1249
	 */
1250
	public function setScrollWheelZoom($value)
1251
	{
1252
		if (!is_bool($value)) {
1253
			throw new MapperArgumentException('Mouse Wheel Zoom must be a boolean.');
1254
		}
1255
1256
		$this->scrollWheelZoom = $value;
1257
	}
1258
1259
	/**
1260
	 * Get map scroll wheel zoom.
1261
	 *
1262
	 * @return boolean
1263
	 */
1264
	public function getScrollWheelZoom()
1265
	{
1266
		return $this->scrollWheelZoom;
1267
	}
1268
1269
	/**
1270
	 * Set map zoom control.
1271
	 *
1272
	 * @param boolean $value
1273
	 *
1274
	 * @throws MapperArgumentException
1275
	 *
1276
	 * @return void
1277
	 */
1278
	public function setZoomControl($value)
1279
	{
1280
		if (!is_bool($value)) {
1281
			throw new MapperArgumentException('Zoom control must be a boolean.');
1282
		}
1283
1284
		$this->zoomControl = $value;
1285
	}
1286
1287
	/**
1288
	 * Get map zoom control.
1289
	 *
1290
	 * @return boolean
1291
	 */
1292
	public function getZoomControl()
1293
	{
1294
		return $this->zoomControl;
1295
	}
1296
1297
    /**
1298
     * Set map type control.
1299
     *
1300
     * @param boolean $value
1301
     *
1302
     * @throws MapperArgumentException
1303
     *
1304
     * @return void
1305
     */
1306
    public function setMapTypeControl($value)
1307
    {
1308
        if (!is_bool($value)) {
1309
            throw new MapperArgumentException('Map type control must be a boolean.');
1310
        }
1311
1312
        $this->mapTypeControl = $value;
1313
    }
1314
1315
    /**
1316
     * Get map type control.
1317
     *
1318
     * @return boolean
1319
     */
1320
    public function getMapTypeControl()
1321
    {
1322
        return $this->mapTypeControl;
1323
    }
1324
1325
	/**
1326
	 * Set map scale control.
1327
	 *
1328
	 * @param boolean $value
1329
	 *
1330
	 * @throws MapperArgumentException
1331
	 *
1332
	 * @return void
1333
	 */
1334
	public function setScaleControl($value)
1335
	{
1336
		if (!is_bool($value)) {
1337
			throw new MapperArgumentException('Scale control must be a boolean.');
1338
		}
1339
1340
		$this->scaleControl = $value;
1341
	}
1342
1343
	/**
1344
	 * Get map scale control.
1345
	 *
1346
	 * @return boolean
1347
	 */
1348
	public function getScaleControl()
1349
	{
1350
		return $this->scaleControl;
1351
	}
1352
1353
	/**
1354
	 * Set map street view control.
1355
	 *
1356
	 * @param boolean $value
1357
	 *
1358
	 * @throws MapperArgumentException
1359
	 *
1360
	 * @return void
1361
	 */
1362
	public function setStreetViewControl($value)
1363
	{
1364
		if (!is_bool($value)) {
1365
			throw new MapperArgumentException('Street view control must be a boolean.');
1366
		}
1367
1368
		$this->streetViewControl = $value;
1369
	}
1370
1371
	/**
1372
	 * Get map street view control.
1373
	 *
1374
	 * @return boolean
1375
	 */
1376
	public function getStreetViewControl()
1377
	{
1378
		return $this->streetViewControl;
1379
	}
1380
1381
	/**
1382
	 * Set map rotate control.
1383
	 *
1384
	 * @param boolean $value
1385
	 *
1386
	 * @throws MapperArgumentException
1387
	 *
1388
	 * @return void
1389
	 */
1390
	public function setRotateControl($value)
1391
	{
1392
		if (!is_bool($value)) {
1393
			throw new MapperArgumentException('Rotate control must be a boolean.');
1394
		}
1395
1396
		$this->rotateControl = $value;
1397
	}
1398
1399
	/**
1400
	 * Get map rotate control.
1401
	 *
1402
	 * @return boolean
1403
	 */
1404
	public function getRotateControl()
1405
	{
1406
		return $this->rotateControl;
1407
	}
1408
1409
    /**
1410
     * Set map fullscreen control.
1411
     *
1412
     * @param boolean $value
1413
     *
1414
     * @throws MapperArgumentException
1415
     *
1416
     * @return void
1417
     */
1418
    public function setFullscreenControl($value)
1419
    {
1420
        if (!is_bool($value)) {
1421
            throw new MapperArgumentException('Fullscreen control must be a boolean.');
1422
        }
1423
1424
        $this->fullscreenControl = $value;
1425
    }
1426
1427
    /**
1428
     * Get map fullscreen control.
1429
     *
1430
     * @return boolean
1431
     */
1432
    public function getFullscreenControl()
1433
    {
1434
        return $this->fullscreenControl;
1435
    }
1436
1437
	/**
1438
	 * Set map type.
1439
	 *
1440
	 * @param string $value
1441
	 *
1442
	 * @throws MapperArgumentException
1443
	 *
1444
	 * @return void
1445
	 */
1446
	public function setType($value)
1447
	{
1448
		if (!in_array($value, $this->types)) {
1449
			throw new MapperArgumentException('Invalid map type.');
1450
		}
1451
1452
		$this->type = $value;
1453
	}
1454
1455
	/**
1456
	 * Get map type.
1457
	 *
1458
	 * @return string
1459
	 */
1460
	public function getType()
1461
	{
1462
		return $this->type;
1463
	}
1464
1465
	/**
1466
	 * Set map heading.
1467
	 *
1468
	 * @param integer|double $value
1469
	 *
1470
	 * @throws MapperArgumentException
1471
	 *
1472
	 * @return void
1473
	 */
1474
	public function setHeading($value)
1475
	{
1476
		if (!is_numeric($value)) {
1477
			throw new MapperArgumentException('Invalid map heading.');
1478
		}
1479
1480
		$this->heading = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value can also be of type double or string. However, the property $heading is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
1481
	}
1482
1483
	/**
1484
	 * Get map heading.
1485
	 *
1486
	 * @return integer
1487
	 */
1488
	public function getHeading()
1489
	{
1490
		return $this->heading;
1491
	}
1492
1493
	/**
1494
	 * Set map tilt.
1495
	 *
1496
	 * @param integer|double $value
1497
	 *
1498
	 * @throws MapperArgumentException
1499
	 *
1500
	 * @return void
1501
	 */
1502
	public function setTilt($value)
1503
	{
1504
		if (!is_numeric($value)) {
1505
			throw new MapperArgumentException('Invalid map tilt.');
1506
		}
1507
1508
		$this->tilt = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value can also be of type double or string. However, the property $tilt is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
1509
	}
1510
1511
	/**
1512
	 * Get map tilt.
1513
	 *
1514
	 * @return integer
1515
	 */
1516
	public function getTilt()
1517
	{
1518
		return $this->tilt;
1519
	}
1520
1521
	/**
1522
	 * Set map marker icon.
1523
	 *
1524
	 * @param string $value
1525
	 *
1526
	 * @throws MapperArgumentException
1527
	 *
1528
	 * @return void
1529
	 */
1530
	public function setIcon($value)
1531
	{
1532
		if (!is_string($value)) {
1533
			throw new MapperArgumentException('Invalid map marker icon.');
1534
		}
1535
1536
		$this->icon = $value;
1537
	}
1538
1539
	/**
1540
	 * Get map marker icon.
1541
	 *
1542
	 * @return string
1543
	 */
1544
	public function getIcon()
1545
	{
1546
		return $this->icon;
1547
	}
1548
1549
	/**
1550
	 * Set map marker animation.
1551
	 *
1552
	 * @param string $value
1553
	 *
1554
	 * @throws MapperArgumentException
1555
	 *
1556
	 * @return void
1557
	 */
1558
	public function setAnimation($value)
1559
	{
1560
		if (!in_array($value, $this->animations)) {
1561
			throw new MapperArgumentException('Invalid map marker animation.');
1562
		}
1563
1564
		$this->animation = $value;
1565
	}
1566
1567
	/**
1568
	 * Get map marker animation.
1569
	 *
1570
	 * @return string
1571
	 */
1572
	public function getAnimation()
1573
	{
1574
		return $this->animation;
1575
	}
1576
1577
	/**
1578
	 * Set cluster status.
1579
	 *
1580
	 * @param boolean $value
1581
	 *
1582
	 * @throws MapperArgumentException
1583
	 *
1584
	 * @return void
1585
	 */
1586
	protected function setCluster($value)
1587
	{
1588
		if (!is_bool($value)) {
1589
			throw new MapperArgumentException('Invalid map cluster setting.');
1590
		}
1591
1592
		$this->cluster = $value;
1593
	}
1594
1595
	/**
1596
	 * Get the cluster status.
1597
	 *
1598
	 * @return boolean
1599
	 */
1600
	public function getCluster()
1601
	{
1602
		return $this->cluster;
1603
	}
1604
1605
	/**
1606
	 * Enable cluster.
1607
	 *
1608
	 * @return void
1609
	 */
1610
	public function enableCluster()
1611
	{
1612
		$this->setCluster(true);
1613
	}
1614
1615
	/**
1616
	 * Disable cluster.
1617
	 *
1618
	 * @return void
1619
	 */
1620
	public function disableCluster()
1621
	{
1622
		$this->setCluster(false);
1623
	}
1624
1625
	/**
1626
	 * Set map cluster icon.
1627
	 *
1628
	 * @param string $value
1629
	 *
1630
	 * @throws MapperArgumentException
1631
	 *
1632
	 * @return void
1633
	 */
1634
	public function setClustersIcon($value)
1635
	{
1636
		if (!is_string($value)) {
1637
			throw new MapperArgumentException('Invalid map clusters icon setting.');
1638
		}
1639
1640
		$this->clustersIcon = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value of type string is incompatible with the declared type array of property $clustersIcon.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
1641
	}
1642
1643
	/**
1644
	 * Get map clusters icon.
1645
	 *
1646
	 * @return string
1647
	 */
1648
	public function getClustersIcon()
1649
	{
1650
		return $this->clustersIcon;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->clustersIcon; (array) is incompatible with the return type declared by the interface Cornford\Googlmapper\Con...erface::getClustersIcon of type string.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
1651
	}
1652
1653
	/**
1654
	 * Set map cluster grid.
1655
	 *
1656
	 * @param integer $value
1657
	 *
1658
	 * @throws MapperArgumentException
1659
	 *
1660
	 * @return void
1661
	 */
1662
	public function setClustersGrid($value)
1663
	{
1664
		if (!is_integer($value)) {
1665
			throw new MapperArgumentException('Invalid map clusters grid setting.');
1666
		}
1667
1668
		$this->clustersGrid = $value;
1669
	}
1670
1671
	/**
1672
	 * Get map cluster grid.
1673
	 *
1674
	 * @return integer
1675
	 */
1676
	public function getClustersGrid()
1677
	{
1678
		return $this->clustersGrid;
1679
	}
1680
1681
	/**
1682
	 * Set map cluster zoom.
1683
	 *
1684
	 * @param integer|null $value
1685
	 *
1686
	 * @throws MapperArgumentException
1687
	 *
1688
	 * @return void
1689
	 */
1690
	public function setClustersZoom($value)
1691
	{
1692
		if (!is_integer($value) && !is_null($value)) {
1693
			throw new MapperArgumentException('Invalid map clusters zoom setting.');
1694
		}
1695
1696
		$this->clustersZoom = $value;
1697
	}
1698
1699
	/**
1700
	 * Get map cluster grid.
1701
	 *
1702
	 * @return integer|null
1703
	 */
1704
	public function getClustersZoom()
1705
	{
1706
		return $this->clustersZoom;
1707
	}
1708
1709
	/**
1710
	 * Set map cluster center.
1711
	 *
1712
	 * @param boolean $value
1713
	 *
1714
	 * @throws MapperArgumentException
1715
	 *
1716
	 * @return void
1717
	 */
1718
	public function setClustersCenter($value)
1719
	{
1720
		if (!is_bool($value)) {
1721
			throw new MapperArgumentException('Invalid map clusters center setting.');
1722
		}
1723
1724
		$this->clustersCenter = $value;
1725
	}
1726
1727
	/**
1728
	 * Get map cluster center.
1729
	 *
1730
	 * @return boolean
1731
	 */
1732
	public function getClustersCenter()
1733
	{
1734
		return $this->clustersCenter;
1735
	}
1736
1737
	/**
1738
	 * Set map cluster size.
1739
	 *
1740
	 * @param integer $value
1741
	 *
1742
	 * @throws MapperArgumentException
1743
	 *
1744
	 * @return void
1745
	 */
1746
	public function setClustersSize($value)
1747
	{
1748
		if (!is_integer($value)) {
1749
			throw new MapperArgumentException('Invalid map clusters size setting.');
1750
		}
1751
1752
		$this->clustersSize = $value;
1753
	}
1754
1755
	/**
1756
	 * Get map cluster size.
1757
	 *
1758
	 * @return integer
1759
	 */
1760
	public function getClustersSize()
1761
	{
1762
		return $this->clustersSize;
1763
	}
1764
1765
	/**
1766
	 * Get mapper options.
1767
	 *
1768
	 * @return array
1769
	 */
1770
	protected function getOptions()
1771
	{
1772
		return [
1773
			'key' => $this->getKey(),
1774
			'version' => $this->version,
1775
			'region' => $this->getRegion(),
1776
			'language' => $this->getLanguage(),
1777
			'async' => $this->getAsync(),
1778
			'user' => $this->getUser(),
1779
			'marker' => $this->getMarker(),
1780
			'center' => $this->getCenter(),
1781
			'locate' => $this->getLocate(),
1782
			'zoom' => $this->getZoom(),
1783
			'scrollWheelZoom' => $this->getScrollWheelZoom(),
1784
			'fullscreenControl' => $this->getFullscreenControl(),
1785
			'zoomControl' => $this->getZoomControl(),
1786
			'scaleControl' => $this->getScaleControl(),
1787
			'streetViewControl' => $this->getStreetViewControl(),
1788
			'rotateControl' => $this->getRotateControl(),
1789
			'mapTypeControl' => $this->getMapTypeControl(),
1790
			'type' => $this->getType(),
1791
			'heading' => $this->getHeading(),
1792
			'tilt' => $this->getTilt(),
1793
			'ui' => $this->getUi(),
1794
			'overlay' => '',
1795
			'markers' => [
1796
				'title' => '',
1797
				'label' => '',
1798
				'content' => '',
1799
				'icon' => $this->getIcon(),
1800
				'place' => '',
1801
				'animation' => $this->getAnimation(),
1802
				'symbol' => '',
1803
			],
1804
			'cluster' => $this->getCluster(),
1805
			'clusters' => [
1806
				'icon' => $this->getClustersIcon(),
1807
				'grid' => $this->getClustersGrid(),
1808
				'zoom' => $this->getClustersZoom(),
1809
				'center' => $this->getClustersCenter(),
1810
				'size' => $this->getClustersSize()
1811
			],
1812
		];
1813
	}
1814
1815
	/**
1816
	 * Add mapping item.
1817
	 *
1818
	 * @param object $value
1819
	 *
1820
	 * @return void
1821
	 */
1822
	protected function addItem($value)
1823
	{
1824
		$this->items[] = $value;
1825
	}
1826
1827
	/**
1828
	 * Set mapping items.
1829
	 *
1830
	 * @param array $array
1831
	 *
1832
	 * @return void
1833
	 */
1834
	protected function setItems(array $array)
1835
	{
1836
		$this->items = $array;
1837
	}
1838
1839
	/**
1840
	 * Get the mapping items.
1841
	 *
1842
	 * @return array
1843
	 */
1844
	public function getItems()
1845
	{
1846
		return $this->items;
1847
	}
1848
1849
	/**
1850
	 * Get a mapping item by reference.
1851
	 *
1852
	 * @param integer $item
1853
	 *
1854
	 * @return array|boolean
1855
	 */
1856
	public function getItem($item)
1857
	{
1858
		return isset($this->items[$item]) ? $this->items[$item] : false;
1859
	}
1860
1861
}