Completed
Push — master ( a84867...e6acb7 )
by Bradley
01:32
created

MapperBase::setCenter()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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 MARKER = true;
24
25
	const CENTER = true;
26
27
	const LOCATE = false;
28
29
	const ZOOM = 8;
30
	const SCROLL_WHEEL_ZOOM = true;
31
32
    const CONTROL_ZOOM = true;
33
    const CONTROL_MAP_TYPE = true;
34
    const CONTROL_SCALE = false;
35
    const CONTROL_STREET_VIEW = true;
36
    const CONTROL_ROTATE = false;
37
    const CONTROL_FULLSCREEN = true;
38
39
    const HEADING = 0;
40
41
	const TILT = 0;
42
43
	const UI = true;
44
45
	const ANIMATION_NONE = 'NONE';
46
	const ANIMATION_DROP = 'DROP';
47
	const ANIMATION_BOUNCE = 'BOUNCE';
48
49
	const OVERLAY_NONE = 'NONE';
50
	const OVERLAY_BIKE = 'BIKE';
51
	const OVERLAY_TRANSIT = 'TRANSIT';
52
	const OVERLAY_TRAFFIC = 'TRAFFIC';
53
54
	const SYMBOL_CIRCLE = 'CIRCLE';
55
	const SYMBOL_BACKWARD_CLOSED_ARROW = 'BACKWARD_CLOSED_ARROW';
56
	const SYMBOL_FORWARD_CLOSED_ARROW = 'FORWARD_CLOSED_ARROW';
57
	const SYMBOL_BACKWARD_OPEN_ARROW = 'BACKWARD_OPEN_ARROW';
58
	const SYMBOL_FORWARD_OPEN_ARROW = 'FORWARD_OPEN_ARROW';
59
60
	const ICON = '';
61
62
	const CLUSTER = true;
63
64
	const CLUSTERS_ICON = '//googlemaps.github.io/js-marker-clusterer/images/m';
65
	const CLUSTERS_GRID = 60;
66
	const CLUSTERS_ZOOM = null;
67
	const CLUSTERS_CENTER = false;
68
	const CLUSTERS_SIZE = 2;
69
70
	/**
71
	 * View.
72
	 *
73
	 * @var \Illuminate\View\Factory
74
	 */
75
	protected $view;
76
77
	/**
78
	 * Mapping enabled.
79
	 *
80
	 * @var boolean
81
	 */
82
	protected $enabled;
83
84
	/**
85
	 * API Key.
86
	 *
87
	 * @var string
88
	 */
89
	protected $key;
90
91
	/**
92
	 * API Version.
93
	 *
94
	 * @var integer
95
	 */
96
	protected $version = '3.31';
97
98
	/**
99
	 * API region.
100
	 *
101
	 * @var string
102
	 */
103
	protected $region;
104
105
	/**
106
	 * API regions.
107
	 *
108
	 * @var array
109
	 */
110
	protected $regions = [
111
		'AF',
112
		'AX',
113
		'AL',
114
		'DZ',
115
		'AS',
116
		'AD',
117
		'AO',
118
		'AI',
119
		'AQ',
120
		'AG',
121
		'AR',
122
		'AM',
123
		'AW',
124
		'AU',
125
		'AT',
126
		'AZ',
127
		'BS',
128
		'BH',
129
		'BD',
130
		'BB',
131
		'BY',
132
		'BE',
133
		'BZ',
134
		'BJ',
135
		'BM',
136
		'BT',
137
		'BO',
138
		'BQ',
139
		'BA',
140
		'BW',
141
		'BV',
142
		'BR',
143
		'IO',
144
		'BN',
145
		'BG',
146
		'BF',
147
		'BI',
148
		'KH',
149
		'CM',
150
		'CA',
151
		'CV',
152
		'KY',
153
		'CF',
154
		'TD',
155
		'CL',
156
		'CN',
157
		'CX',
158
		'CC',
159
		'CO',
160
		'KM',
161
		'CG',
162
		'CD',
163
		'CK',
164
		'CR',
165
		'CI',
166
		'HR',
167
		'CU',
168
		'CW',
169
		'CY',
170
		'CZ',
171
		'DK',
172
		'DJ',
173
		'DM',
174
		'DO',
175
		'EC',
176
		'EG',
177
		'SV',
178
		'GQ',
179
		'ER',
180
		'EE',
181
		'ET',
182
		'FK',
183
		'FO',
184
		'FJ',
185
		'FI',
186
		'FR',
187
		'GF',
188
		'PF',
189
		'TF',
190
		'GA',
191
		'GM',
192
		'GE',
193
		'DE',
194
		'GH',
195
		'GI',
196
		'GR',
197
		'GL',
198
		'GD',
199
		'GP',
200
		'GU',
201
		'GT',
202
		'GG',
203
		'GN',
204
		'GW',
205
		'GY',
206
		'HT',
207
		'HM',
208
		'VA',
209
		'HN',
210
		'HK',
211
		'HU',
212
		'IS',
213
		'IN',
214
		'ID',
215
		'IR',
216
		'IQ',
217
		'IE',
218
		'IM',
219
		'IL',
220
		'IT',
221
		'JM',
222
		'JP',
223
		'JE',
224
		'JO',
225
		'KZ',
226
		'KE',
227
		'KI',
228
		'KP',
229
		'KR',
230
		'KW',
231
		'KG',
232
		'LA',
233
		'LV',
234
		'LB',
235
		'LS',
236
		'LR',
237
		'LY',
238
		'LI',
239
		'LT',
240
		'LU',
241
		'MO',
242
		'MK',
243
		'MG',
244
		'MW',
245
		'MY',
246
		'MV',
247
		'ML',
248
		'MT',
249
		'MH',
250
		'MQ',
251
		'MR',
252
		'MU',
253
		'YT',
254
		'MX',
255
		'FM',
256
		'MD',
257
		'MC',
258
		'MN',
259
		'ME',
260
		'MS',
261
		'MA',
262
		'MZ',
263
		'MM',
264
		'NA',
265
		'NR',
266
		'NP',
267
		'NL',
268
		'NC',
269
		'NZ',
270
		'NI',
271
		'NE',
272
		'NG',
273
		'NU',
274
		'NF',
275
		'MP',
276
		'NO',
277
		'OM',
278
		'PK',
279
		'PW',
280
		'PS',
281
		'PA',
282
		'PG',
283
		'PY',
284
		'PE',
285
		'PH',
286
		'PN',
287
		'PL',
288
		'PT',
289
		'PR',
290
		'QA',
291
		'RE',
292
		'RO',
293
		'RU',
294
		'RW',
295
		'BL',
296
		'SH',
297
		'KN',
298
		'LC',
299
		'MF',
300
		'PM',
301
		'VC',
302
		'WS',
303
		'SM',
304
		'ST',
305
		'SA',
306
		'SN',
307
		'RS',
308
		'SC',
309
		'SL',
310
		'SG',
311
		'SX',
312
		'SK',
313
		'SI',
314
		'SB',
315
		'SO',
316
		'ZA',
317
		'GS',
318
		'SS',
319
		'ES',
320
		'LK',
321
		'SD',
322
		'SR',
323
		'SJ',
324
		'SZ',
325
		'SE',
326
		'CH',
327
		'SY',
328
		'TW',
329
		'TJ',
330
		'TZ',
331
		'TH',
332
		'TL',
333
		'TG',
334
		'TK',
335
		'TO',
336
		'TT',
337
		'TN',
338
		'TR',
339
		'TM',
340
		'TC',
341
		'TV',
342
		'UG',
343
		'UA',
344
		'AE',
345
		'GB',
346
		'US',
347
		'UM',
348
		'UY',
349
		'UZ',
350
		'VU',
351
		'VE',
352
		'VN',
353
		'VG',
354
		'VI',
355
		'WF',
356
		'EH',
357
		'YE',
358
		'ZM',
359
		'ZW'
360
	];
361
362
	/**
363
	 * API Language.
364
	 *
365
	 * @var string
366
	 */
367
	protected $language;
368
369
	/**
370
	 * API Languages.
371
	 *
372
	 * @var array
373
	 */
374
	protected $languages = [
375
		'af',
376
		'ar-ae',
377
		'ar-bh',
378
		'ar-dz',
379
		'ar-eg',
380
		'ar-iq',
381
		'ar-jo',
382
		'ar-kw',
383
		'ar-lb',
384
		'ar-ly',
385
		'ar-ma',
386
		'ar-om',
387
		'ar-qa',
388
		'ar-sa',
389
		'ar-sy',
390
		'ar-tn',
391
		'ar-ye',
392
		'be',
393
		'bg',
394
		'ca',
395
		'cs',
396
		'da',
397
		'de',
398
		'de-at',
399
		'de-ch',
400
		'de-li',
401
		'de-lu',
402
		'el',
403
		'en',
404
		'en-au',
405
		'en-bz',
406
		'en-ca',
407
		'en-gb',
408
		'en-ie',
409
		'en-jm',
410
		'en-nz',
411
		'en-tt',
412
		'en-us',
413
		'en-za',
414
		'es',
415
		'es-ar',
416
		'es-bo',
417
		'es-cl',
418
		'es-co',
419
		'es-cr',
420
		'es-do',
421
		'es-ec',
422
		'es-gt',
423
		'es-hn',
424
		'es-mx',
425
		'es-ni',
426
		'es-pa',
427
		'es-pe',
428
		'es-pr',
429
		'es-py',
430
		'es-sv',
431
		'es-uy',
432
		'es-ve',
433
		'et',
434
		'eu',
435
		'fa',
436
		'fi',
437
		'fo',
438
		'fr',
439
		'fr-be',
440
		'fr-ca',
441
		'fr-ch',
442
		'fr-lu',
443
		'ga',
444
		'gd',
445
		'he',
446
		'hi',
447
		'hr',
448
		'hu',
449
		'id',
450
		'is',
451
		'it',
452
		'it-ch',
453
		'ja',
454
		'ji',
455
		'ko',
456
		'ko',
457
		'ku',
458
		'lt',
459
		'lv',
460
		'mk',
461
		'ml',
462
		'ms',
463
		'mt',
464
		'nl',
465
		'nl-be',
466
		'nb',
467
		'nn',
468
		'no',
469
		'pa',
470
		'pl',
471
		'pt',
472
		'pt-br',
473
		'rm',
474
		'ro',
475
		'ro-md',
476
		'ru',
477
		'ru-md',
478
		'sb',
479
		'sk',
480
		'sl',
481
		'sq',
482
		'sr',
483
		'sv',
484
		'sv-fi',
485
		'th',
486
		'tn',
487
		'tr',
488
		'ts',
489
		'uk',
490
		'ur',
491
		've',
492
		'vi',
493
		'xh',
494
		'zh-cn',
495
		'zh-hk',
496
		'zh-sg',
497
		'zh-tw',
498
		'zu'
499
	];
500
501
	/**
502
	 * Async maps.
503
	 *
504
	 * @var boolean
505
	 */
506
	protected $async;
507
508
	/**
509
	 * Automatic map marker.
510
	 *
511
	 * @var boolean
512
	 */
513
	protected $marker;
514
515
	/**
516
	 * Center map automatically.
517
	 *
518
	 * @var boolean
519
	 */
520
	protected $center;
521
522
	/**
523
	 * Locate users location.
524
	 *
525
	 * @var boolean
526
	 */
527
	protected $locate;
528
529
	/**
530
	 * Show map UI.
531
	 *
532
	 * @var boolean
533
	 */
534
	protected $ui;
535
536
	/**
537
	 * Map zoom level.
538
	 *
539
	 * @var integer
540
	 */
541
	protected $zoom;
542
543
	/**
544
	 * Map scroll wheel zoom.
545
	 *
546
	 * @var boolean
547
	 */
548
	protected $scrollWheelZoom;
549
550
    /**
551
     * Map zoom control.
552
     *
553
     * @var boolean
554
     */
555
    protected $zoomControl;
556
557
    /**
558
     * Map type control.
559
     *
560
     * @var boolean
561
     */
562
    protected $mapTypeControl;
563
564
    /**
565
	 * Map scale control.
566
	 *
567
	 * @var boolean
568
	 */
569
	protected $scaleControl;
570
571
    /**
572
	 * Map street view control.
573
	 *
574
	 * @var boolean
575
	 */
576
	protected $streetViewControl;
577
578
    /**
579
	 * Map rotate control.
580
	 *
581
	 * @var boolean
582
	 */
583
	protected $rotateControl;
584
585
    /**
586
     * Map fullscreen control.
587
     *
588
     * @var boolean
589
     */
590
    protected $fullscreenControl;
591
592
    /**
593
	 * Map type.
594
	 *
595
	 * @var string
596
	 */
597
	protected $type;
598
599
	/**
600
	 * Available map types.
601
	 *
602
	 * @var array
603
	 */
604
	protected $types = [
605
		'ROADMAP',
606
		'SATELLITE',
607
		'HYBRID',
608
		'TERRAIN'
609
	];
610
611
    /**
612
     * Map heading.
613
     *
614
     * @var integer
615
     */
616
    protected $heading;
617
618
	/**
619
	 * Map tilt.
620
	 *
621
	 * @var integer
622
	 */
623
	protected $tilt;
624
625
	/**
626
	 * Map marker icon.
627
	 *
628
	 * @var string
629
	 */
630
	protected $icon;
631
632
	/**
633
	 * Map marker animation.
634
	 *
635
	 * @var string
636
	 */
637
	protected $animation;
638
639
	/**
640
	 * Available map marker animations.
641
	 *
642
	 * @var array
643
	 */
644
	protected $animations = [
645
		'NONE',
646
		'DROP',
647
		'BOUNCE',
648
	];
649
650
	/**
651
	 * Map marker cluster.
652
	 *
653
	 * @var boolean
654
	 */
655
	protected $cluster;
656
657
	/**
658
	 * Map marker clusters icon.
659
	 *
660
	 * @var array
661
	 */
662
	protected $clustersIcon;
663
664
	/**
665
	 * Map marker clusters grid.
666
	 *
667
	 * @var integer
668
	 */
669
	protected $clustersGrid;
670
671
	/**
672
	 * Map marker clusters zoom.
673
	 *
674
	 * @var integer|null
675
	 */
676
	protected $clustersZoom;
677
678
	/**
679
	 * Map marker clusters center.
680
	 *
681
	 * @var boolean
682
	 */
683
	protected $clustersCenter;
684
685
	/**
686
	 * Map marker clusters size.
687
	 *
688
	 * @var integer
689
	 */
690
	protected $clustersSize;
691
692
	/**
693
	 * Mapping items.
694
	 *
695
	 * @var array
696
	 */
697
	public $items = [];
698
699
	/**
700
	 * Construct Googlmapper.
701
	 *
702
	 * @param View  $view
703
	 * @param array $options
704
	 *
705
	 * @throws MapperArgumentException
706
	 */
707
	public function __construct(View $view, array $options = [])
708
	{
709
		$this->view = $view;
710
711
		if (!isset($options['key'])) {
712
			throw new MapperArgumentException('Google maps API key is required.');
713
		}
714
715
		if (!isset($options['region'])) {
716
			throw new MapperArgumentException('Region is required.');
717
		}
718
719
		if (!in_array($options['region'], $this->regions)) {
720
			throw new MapperArgumentException('Region is required in ISO 3166-1 code format.');
721
		}
722
723
		if (!isset($options['language']) || !in_array($options['language'], $this->languages)) {
724
			throw new MapperArgumentException('Language is required.');
725
		}
726
727
		if (!in_array($options['language'], $this->languages)) {
728
			throw new MapperArgumentException('Language is required in ISO 639-1 code format.');
729
		}
730
731
		$this->setEnabled(isset($options['enabled']) ? $options['enabled'] : self::ENABLED);
732
		$this->setKey($options['key']);
733
		$this->setRegion(isset($options['region']) ? $options['region'] : self::REGION);
734
		$this->setLanguage(isset($options['language']) ? $options['language'] : self::LANGUAGE);
735
		$this->setAsync(isset($options['async']) ? $options['async'] : self::ASYNC);
736
		$this->setMarker(isset($options['marker']) ? $options['marker'] : self::MARKER);
737
		$this->setCenter(isset($options['center']) ? $options['center'] : self::CENTER);
738
		$this->setLocate(isset($options['locate']) ? $options['locate'] : self::LOCATE);
739
		$this->setZoom(isset($options['zoom']) ? $options['zoom'] : self::ZOOM);
740
		$this->setScrollWheelZoom(isset($options['scrollWheelZoom']) ? $options['scrollWheelZoom'] : self::SCROLL_WHEEL_ZOOM);
741
        $this->setZoomControl(isset($options['zoomControl']) ? $options['zoomControl'] : self::CONTROL_ZOOM);
742
        $this->setMapTypeControl(isset($options['mapTypeControl']) ? $options['mapTypeControl'] : self::CONTROL_MAP_TYPE);
743
        $this->setScaleControl(isset($options['scaleControl']) ? $options['scaleControl'] : self::CONTROL_SCALE);
744
        $this->setStreetViewControl(isset($options['streetViewControl']) ? $options['streetViewControl'] : self::CONTROL_STREET_VIEW);
745
        $this->setRotateControl(isset($options['rotateControl']) ? $options['rotateControl'] : self::CONTROL_ROTATE);
746
        $this->setFullscreenControl(isset($options['fullscreenControl']) ? $options['fullscreenControl'] : self::CONTROL_FULLSCREEN);
747
        $this->setType(isset($options['type']) ? $options['type'] : self::TYPE_ROADMAP);
748
		$this->setHeading(isset($options['heading']) ? $options['heading'] : self::HEADING);
749
		$this->setTilt(isset($options['tilt']) ? $options['tilt'] : self::TILT);
750
		$this->setUi(isset($options['ui']) ? $options['ui'] : self::UI);
751
		$this->setIcon(isset($options['markers']['icon']) ? $options['markers']['icon'] : self::ICON);
752
		$this->setAnimation(isset($options['markers']['animation']) ? $options['markers']['animation'] : self::ANIMATION_NONE);
753
		$this->setCluster(isset($options['cluster']) ? $options['cluster'] : self::CLUSTER);
754
		$this->setClustersIcon(isset($options['clusters']['icon']) ? $options['clusters']['icon'] : self::CLUSTERS_ICON);
755
		$this->setClustersGrid(isset($options['clusters']['grid']) ? $options['clusters']['grid'] : self::CLUSTERS_GRID);
756
		$this->setClustersZoom(isset($options['clusters']['zoom']) ? $options['clusters']['zoom'] : self::CLUSTERS_ZOOM);
757
		$this->setClustersCenter(isset($options['clusters']['center']) ? $options['clusters']['center'] : self::CLUSTERS_CENTER);
758
		$this->setClustersSize(isset($options['clusters']['size']) ? $options['clusters']['size'] : self::CLUSTERS_SIZE);
759
	}
760
761
	/**
762
	 * Is mapping enabled?
763
	 *
764
	 * @return boolean
765
	 */
766
	public function isEnabled()
767
	{
768
		return $this->getEnabled();
769
	}
770
771
	/**
772
	 * Set enabled status.
773
	 *
774
	 * @param boolean $value
775
	 *
776
	 * @throws MapperArgumentException
777
	 *
778
	 * @return void
779
	 */
780
	protected function setEnabled($value)
781
	{
782
		if (!is_bool($value)) {
783
			throw new MapperArgumentException('Invalid map enabled setting.');
784
		}
785
786
		$this->enabled = $value;
787
	}
788
789
	/**
790
	 * Get the enabled status.
791
	 *
792
	 * @return boolean
793
	 */
794
	protected function getEnabled()
795
	{
796
		return $this->enabled;
797
	}
798
799
	/**
800
	 * Enable mapping.
801
	 *
802
	 * @return void
803
	 */
804
	public function enableMapping()
805
	{
806
		$this->setEnabled(true);
807
	}
808
809
	/**
810
	 * Disable mapping.
811
	 *
812
	 * @return void
813
	 */
814
	public function disableMapping()
815
	{
816
		$this->setEnabled(false);
817
	}
818
819
	/**
820
	 * Set the Google Maps key.
821
	 *
822
	 * @param string $value
823
	 *
824
	 * @throws MapperArgumentException
825
	 *
826
	 * @return void
827
	 */
828
	public function setKey($value)
829
	{
830
		if (!is_string($value)) {
831
			throw new MapperArgumentException('Invalid Google Map\'s API key.');
832
		}
833
834
		$this->key = $value;
835
	}
836
837
	/**
838
	 * Get the Google Maps key.
839
	 *
840
	 * @return string
841
	 */
842
	public function getKey()
843
	{
844
		return $this->key;
845
	}
846
847
	/**
848
	 * Set the Google Maps region.
849
	 *
850
	 * @param string $value
851
	 *
852
	 * @throws MapperArgumentException
853
	 *
854
	 * @return void
855
	 */
856 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...
857
	{
858
		if (!is_string($value)) {
859
			throw new MapperArgumentException('Invalid map region.');
860
		}
861
862
		if (!in_array($value, $this->regions)) {
863
			throw new MapperArgumentException('Region is required in ISO 3166-1 code format.');
864
		}
865
866
		$this->region = $value;
867
	}
868
869
	/**
870
	 * Get the Google Maps region.
871
	 *
872
	 * @return string
873
	 */
874
	public function getRegion()
875
	{
876
		return $this->region;
877
	}
878
879
	/**
880
	 * Set the Google Maps language.
881
	 *
882
	 * @param string $value
883
	 *
884
	 * @throws MapperArgumentException
885
	 *
886
	 * @return void
887
	 */
888 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...
889
	{
890
		if (!is_string($value)) {
891
			throw new MapperArgumentException('Invalid map language.');
892
		}
893
894
		if (!in_array($value, $this->languages)) {
895
			throw new MapperArgumentException('Language is required in ISO 639-1 code format.');
896
		}
897
898
		$this->language = $value;
899
	}
900
901
	/**
902
	 * Get the Google Maps language.
903
	 *
904
	 * @return string
905
	 */
906
	public function getLanguage()
907
	{
908
		return $this->language;
909
	}
910
911
    /**
912
     * Set the map async status.
913
     *
914
     * @param boolean $value
915
     *
916
     * @throws MapperArgumentException
917
     *
918
     * @return void
919
     */
920
    protected function setAsync($value)
921
    {
922
        if (!is_bool($value)) {
923
            throw new MapperArgumentException('Invalid map async status.');
924
        }
925
926
        $this->async = $value;
927
    }
928
929
    /**
930
     * Get the map async status.
931
     *
932
     * @return boolean
933
     */
934
    public function getAsync()
935
    {
936
        return $this->async;
937
    }
938
939
    /**
940
     * Enable async for maps.
941
     *
942
     * @return void
943
     */
944
    public function enableAsync()
945
    {
946
        $this->setAsync(true);
947
    }
948
949
    /**
950
     * Disable async for maps.
951
     *
952
     * @return void
953
     */
954
    public function disableAsync()
955
    {
956
        $this->setAsync(false);
957
    }
958
959
	/**
960
	 * Set the marker status.
961
	 *
962
	 * @param boolean $value
963
	 *
964
	 * @throws MapperArgumentException
965
	 *
966
	 * @return void
967
	 */
968
	protected function setMarker($value)
969
	{
970
		if (!is_bool($value)) {
971
			throw new MapperArgumentException('Invalid map marker setting.');
972
		}
973
974
		$this->marker = $value;
975
	}
976
977
	/**
978
	 * Get the marker status.
979
	 *
980
	 * @return boolean
981
	 */
982
	public function getMarker()
983
	{
984
		return $this->marker;
985
	}
986
987
	/**
988
	 * Enable markers for maps.
989
	 *
990
	 * @return void
991
	 */
992
	public function enableMarkers()
993
	{
994
		$this->setMarker(true);
995
	}
996
997
	/**
998
	 * Disable markers for maps.
999
	 *
1000
	 * @return void
1001
	 */
1002
	public function disableMarkers()
1003
	{
1004
		$this->setMarker(false);
1005
	}
1006
1007
	/**
1008
	 * Set the map center status.
1009
	 *
1010
	 * @param boolean $value
1011
	 *
1012
	 * @throws MapperArgumentException
1013
	 *
1014
	 * @return void
1015
	 */
1016
	protected function setCenter($value)
1017
	{
1018
		if (!is_bool($value)) {
1019
			throw new MapperArgumentException('Invalid map center setting.');
1020
		}
1021
1022
		$this->center = $value;
1023
	}
1024
1025
	/**
1026
	 * Get the map center status.
1027
	 *
1028
	 * @return boolean
1029
	 */
1030
	public function getCenter()
1031
	{
1032
		return $this->center;
1033
	}
1034
1035
	/**
1036
	 * Enable center of maps.
1037
	 *
1038
	 * @return void
1039
	 */
1040
	public function enableCenter()
1041
	{
1042
		$this->setCenter(true);
1043
	}
1044
1045
	/**
1046
	 * Disable center of maps.
1047
	 *
1048
	 * @return void
1049
	 */
1050
	public function disableCenter()
1051
	{
1052
		$this->setCenter(false);
1053
	}
1054
1055
	/**
1056
	 * Set the map locate user status.
1057
	 *
1058
	 * @param boolean $value
1059
	 *
1060
	 * @throws MapperArgumentException
1061
	 *
1062
	 * @return void
1063
	 */
1064
	protected function setLocate($value)
1065
	{
1066
		if (!is_bool($value)) {
1067
			throw new MapperArgumentException('Invalid map locate setting.');
1068
		}
1069
1070
		$this->locate = $value;
1071
	}
1072
1073
	/**
1074
	 * Get the map locate user status.
1075
	 *
1076
	 * @return boolean
1077
	 */
1078
	public function getLocate()
1079
	{
1080
		return $this->locate;
1081
	}
1082
1083
	/**
1084
	 * Enable locate user position on maps.
1085
	 *
1086
	 * @return void
1087
	 */
1088
	public function enableLocate()
1089
	{
1090
		$this->setLocate(true);
1091
	}
1092
1093
	/**
1094
	 * Disable locate user position on maps.
1095
	 *
1096
	 * @return void
1097
	 */
1098
	public function disableLocate()
1099
	{
1100
		$this->setLocate(false);
1101
	}
1102
1103
	/**
1104
	 * Set the map UI status.
1105
	 *
1106
	 * @param boolean $value
1107
	 *
1108
	 * @throws MapperArgumentException
1109
	 *
1110
	 * @return void
1111
	 */
1112
	protected function setUi($value)
1113
	{
1114
		if (!is_bool($value)) {
1115
			throw new MapperArgumentException('Invalid map ui setting.');
1116
		}
1117
1118
		$this->ui = $value;
1119
	}
1120
1121
	/**
1122
	 * Get the map UI status.
1123
	 *
1124
	 * @return boolean
1125
	 */
1126
	public function getUi()
1127
	{
1128
		return $this->ui;
1129
	}
1130
1131
	/**
1132
	 * Enable maps ui.
1133
	 *
1134
	 * @return void
1135
	 */
1136
	public function enableUi()
1137
	{
1138
		$this->setUi(false);
1139
	}
1140
1141
	/**
1142
	 * Disable maps ui.
1143
	 *
1144
	 * @return void
1145
	 */
1146
	public function disableUi()
1147
	{
1148
		$this->setUi(true);
1149
	}
1150
1151
	/**
1152
	 * Set map zoom level.
1153
	 *
1154
	 * @param integer $value
1155
	 *
1156
	 * @throws MapperArgumentException
1157
	 *
1158
	 * @return void
1159
	 */
1160
	public function setZoom($value)
1161
	{
1162
		if (!is_numeric($value)) {
1163
			throw new MapperArgumentException('Zoom level must be an integer.');
1164
		}
1165
1166
		if ($value < 1 || $value > 20) {
1167
			throw new MapperArgumentException('A zoom level must be between 1 and 20.');
1168
		}
1169
1170
		$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...
1171
	}
1172
1173
	/**
1174
	 * Get map zoom level.
1175
	 *
1176
	 * @return integer
1177
	 */
1178
	public function getZoom()
1179
	{
1180
		return $this->zoom;
1181
	}
1182
1183
	/**
1184
	 * Set map scroll wheel zoom.
1185
	 *
1186
	 * @param boolean $value
1187
	 *
1188
	 * @throws MapperArgumentException
1189
	 *
1190
	 * @return void
1191
	 */
1192
	public function setScrollWheelZoom($value)
1193
	{
1194
		if (!is_bool($value)) {
1195
			throw new MapperArgumentException('Mouse Wheel Zoom must be a boolean.');
1196
		}
1197
1198
		$this->scrollWheelZoom = $value;
1199
	}
1200
1201
	/**
1202
	 * Get map scroll wheel zoom.
1203
	 *
1204
	 * @return boolean
1205
	 */
1206
	public function getScrollWheelZoom()
1207
	{
1208
		return $this->scrollWheelZoom;
1209
	}
1210
1211
	/**
1212
	 * Set map zoom control.
1213
	 *
1214
	 * @param boolean $value
1215
	 *
1216
	 * @throws MapperArgumentException
1217
	 *
1218
	 * @return void
1219
	 */
1220
	public function setZoomControl($value)
1221
	{
1222
		if (!is_bool($value)) {
1223
			throw new MapperArgumentException('Zoom control must be a boolean.');
1224
		}
1225
1226
		$this->zoomControl = $value;
1227
	}
1228
1229
	/**
1230
	 * Get map zoom control.
1231
	 *
1232
	 * @return boolean
1233
	 */
1234
	public function getZoomControl()
1235
	{
1236
		return $this->zoomControl;
1237
	}
1238
1239
    /**
1240
     * Set map type control.
1241
     *
1242
     * @param boolean $value
1243
     *
1244
     * @throws MapperArgumentException
1245
     *
1246
     * @return void
1247
     */
1248
    public function setMapTypeControl($value)
1249
    {
1250
        if (!is_bool($value)) {
1251
            throw new MapperArgumentException('Map type control must be a boolean.');
1252
        }
1253
1254
        $this->mapTypeControl = $value;
1255
    }
1256
1257
    /**
1258
     * Get map type control.
1259
     *
1260
     * @return boolean
1261
     */
1262
    public function getMapTypeControl()
1263
    {
1264
        return $this->mapTypeControl;
1265
    }
1266
1267
	/**
1268
	 * Set map scale control.
1269
	 *
1270
	 * @param boolean $value
1271
	 *
1272
	 * @throws MapperArgumentException
1273
	 *
1274
	 * @return void
1275
	 */
1276
	public function setScaleControl($value)
1277
	{
1278
		if (!is_bool($value)) {
1279
			throw new MapperArgumentException('Scale control must be a boolean.');
1280
		}
1281
1282
		$this->scaleControl = $value;
1283
	}
1284
1285
	/**
1286
	 * Get map scale control.
1287
	 *
1288
	 * @return boolean
1289
	 */
1290
	public function getScaleControl()
1291
	{
1292
		return $this->scaleControl;
1293
	}
1294
1295
	/**
1296
	 * Set map street view control.
1297
	 *
1298
	 * @param boolean $value
1299
	 *
1300
	 * @throws MapperArgumentException
1301
	 *
1302
	 * @return void
1303
	 */
1304
	public function setStreetViewControl($value)
1305
	{
1306
		if (!is_bool($value)) {
1307
			throw new MapperArgumentException('Street view control must be a boolean.');
1308
		}
1309
1310
		$this->streetViewControl = $value;
1311
	}
1312
1313
	/**
1314
	 * Get map street view control.
1315
	 *
1316
	 * @return boolean
1317
	 */
1318
	public function getStreetViewControl()
1319
	{
1320
		return $this->streetViewControl;
1321
	}
1322
1323
	/**
1324
	 * Set map rotate control.
1325
	 *
1326
	 * @param boolean $value
1327
	 *
1328
	 * @throws MapperArgumentException
1329
	 *
1330
	 * @return void
1331
	 */
1332
	public function setRotateControl($value)
1333
	{
1334
		if (!is_bool($value)) {
1335
			throw new MapperArgumentException('Rotate control must be a boolean.');
1336
		}
1337
1338
		$this->rotateControl = $value;
1339
	}
1340
1341
	/**
1342
	 * Get map rotate control.
1343
	 *
1344
	 * @return boolean
1345
	 */
1346
	public function getRotateControl()
1347
	{
1348
		return $this->rotateControl;
1349
	}
1350
1351
    /**
1352
     * Set map fullscreen control.
1353
     *
1354
     * @param boolean $value
1355
     *
1356
     * @throws MapperArgumentException
1357
     *
1358
     * @return void
1359
     */
1360
    public function setFullscreenControl($value)
1361
    {
1362
        if (!is_bool($value)) {
1363
            throw new MapperArgumentException('Fullscreen control must be a boolean.');
1364
        }
1365
1366
        $this->fullscreenControl = $value;
1367
    }
1368
1369
    /**
1370
     * Get map fullscreen control.
1371
     *
1372
     * @return boolean
1373
     */
1374
    public function getFullscreenControl()
1375
    {
1376
        return $this->fullscreenControl;
1377
    }
1378
1379
	/**
1380
	 * Set map type.
1381
	 *
1382
	 * @param string $value
1383
	 *
1384
	 * @throws MapperArgumentException
1385
	 *
1386
	 * @return void
1387
	 */
1388
	public function setType($value)
1389
	{
1390
		if (!in_array($value, $this->types)) {
1391
			throw new MapperArgumentException('Invalid map type.');
1392
		}
1393
1394
		$this->type = $value;
1395
	}
1396
1397
	/**
1398
	 * Get map type.
1399
	 *
1400
	 * @return string
1401
	 */
1402
	public function getType()
1403
	{
1404
		return $this->type;
1405
	}
1406
1407
	/**
1408
	 * Set map heading.
1409
	 *
1410
	 * @param integer|double $value
1411
	 *
1412
	 * @throws MapperArgumentException
1413
	 *
1414
	 * @return void
1415
	 */
1416
	public function setHeading($value)
1417
	{
1418
		if (!is_numeric($value)) {
1419
			throw new MapperArgumentException('Invalid map heading.');
1420
		}
1421
1422
		$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...
1423
	}
1424
1425
	/**
1426
	 * Get map heading.
1427
	 *
1428
	 * @return integer
1429
	 */
1430
	public function getHeading()
1431
	{
1432
		return $this->heading;
1433
	}
1434
1435
	/**
1436
	 * Set map tilt.
1437
	 *
1438
	 * @param integer|double $value
1439
	 *
1440
	 * @throws MapperArgumentException
1441
	 *
1442
	 * @return void
1443
	 */
1444
	public function setTilt($value)
1445
	{
1446
		if (!is_numeric($value)) {
1447
			throw new MapperArgumentException('Invalid map tilt.');
1448
		}
1449
1450
		$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...
1451
	}
1452
1453
	/**
1454
	 * Get map tilt.
1455
	 *
1456
	 * @return integer
1457
	 */
1458
	public function getTilt()
1459
	{
1460
		return $this->tilt;
1461
	}
1462
1463
	/**
1464
	 * Set map marker icon.
1465
	 *
1466
	 * @param string $value
1467
	 *
1468
	 * @throws MapperArgumentException
1469
	 *
1470
	 * @return void
1471
	 */
1472
	public function setIcon($value)
1473
	{
1474
		if (!is_string($value)) {
1475
			throw new MapperArgumentException('Invalid map marker icon.');
1476
		}
1477
1478
		$this->icon = $value;
1479
	}
1480
1481
	/**
1482
	 * Get map marker icon.
1483
	 *
1484
	 * @return string
1485
	 */
1486
	public function getIcon()
1487
	{
1488
		return $this->icon;
1489
	}
1490
1491
	/**
1492
	 * Set map marker animation.
1493
	 *
1494
	 * @param string $value
1495
	 *
1496
	 * @throws MapperArgumentException
1497
	 *
1498
	 * @return void
1499
	 */
1500
	public function setAnimation($value)
1501
	{
1502
		if (!in_array($value, $this->animations)) {
1503
			throw new MapperArgumentException('Invalid map marker animation.');
1504
		}
1505
1506
		$this->animation = $value;
1507
	}
1508
1509
	/**
1510
	 * Get map marker animation.
1511
	 *
1512
	 * @return string
1513
	 */
1514
	public function getAnimation()
1515
	{
1516
		return $this->animation;
1517
	}
1518
1519
	/**
1520
	 * Set cluster status.
1521
	 *
1522
	 * @param boolean $value
1523
	 *
1524
	 * @throws MapperArgumentException
1525
	 *
1526
	 * @return void
1527
	 */
1528
	protected function setCluster($value)
1529
	{
1530
		if (!is_bool($value)) {
1531
			throw new MapperArgumentException('Invalid map cluster setting.');
1532
		}
1533
1534
		$this->cluster = $value;
1535
	}
1536
1537
	/**
1538
	 * Get the cluster status.
1539
	 *
1540
	 * @return boolean
1541
	 */
1542
	public function getCluster()
1543
	{
1544
		return $this->cluster;
1545
	}
1546
1547
	/**
1548
	 * Enable cluster.
1549
	 *
1550
	 * @return void
1551
	 */
1552
	public function enableCluster()
1553
	{
1554
		$this->setCluster(true);
1555
	}
1556
1557
	/**
1558
	 * Disable cluster.
1559
	 *
1560
	 * @return void
1561
	 */
1562
	public function disableCluster()
1563
	{
1564
		$this->setCluster(false);
1565
	}
1566
1567
	/**
1568
	 * Set map cluster icon.
1569
	 *
1570
	 * @param string $value
1571
	 *
1572
	 * @throws MapperArgumentException
1573
	 *
1574
	 * @return void
1575
	 */
1576
	public function setClustersIcon($value)
1577
	{
1578
		if (!is_string($value)) {
1579
			throw new MapperArgumentException('Invalid map clusters icon setting.');
1580
		}
1581
1582
		$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...
1583
	}
1584
1585
	/**
1586
	 * Get map clusters icon.
1587
	 *
1588
	 * @return string
1589
	 */
1590
	public function getClustersIcon()
1591
	{
1592
		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...
1593
	}
1594
1595
	/**
1596
	 * Set map cluster grid.
1597
	 *
1598
	 * @param integer $value
1599
	 *
1600
	 * @throws MapperArgumentException
1601
	 *
1602
	 * @return void
1603
	 */
1604
	public function setClustersGrid($value)
1605
	{
1606
		if (!is_integer($value)) {
1607
			throw new MapperArgumentException('Invalid map clusters grid setting.');
1608
		}
1609
1610
		$this->clustersGrid = $value;
1611
	}
1612
1613
	/**
1614
	 * Get map cluster grid.
1615
	 *
1616
	 * @return integer
1617
	 */
1618
	public function getClustersGrid()
1619
	{
1620
		return $this->clustersGrid;
1621
	}
1622
1623
	/**
1624
	 * Set map cluster zoom.
1625
	 *
1626
	 * @param integer|null $value
1627
	 *
1628
	 * @throws MapperArgumentException
1629
	 *
1630
	 * @return void
1631
	 */
1632
	public function setClustersZoom($value)
1633
	{
1634
		if (!is_integer($value) && !is_null($value)) {
1635
			throw new MapperArgumentException('Invalid map clusters zoom setting.');
1636
		}
1637
1638
		$this->clustersZoom = $value;
1639
	}
1640
1641
	/**
1642
	 * Get map cluster grid.
1643
	 *
1644
	 * @return integer|null
1645
	 */
1646
	public function getClustersZoom()
1647
	{
1648
		return $this->clustersZoom;
1649
	}
1650
1651
	/**
1652
	 * Set map cluster center.
1653
	 *
1654
	 * @param boolean $value
1655
	 *
1656
	 * @throws MapperArgumentException
1657
	 *
1658
	 * @return void
1659
	 */
1660
	public function setClustersCenter($value)
1661
	{
1662
		if (!is_bool($value)) {
1663
			throw new MapperArgumentException('Invalid map clusters center setting.');
1664
		}
1665
1666
		$this->clustersCenter = $value;
1667
	}
1668
1669
	/**
1670
	 * Get map cluster center.
1671
	 *
1672
	 * @return boolean
1673
	 */
1674
	public function getClustersCenter()
1675
	{
1676
		return $this->clustersCenter;
1677
	}
1678
1679
	/**
1680
	 * Set map cluster size.
1681
	 *
1682
	 * @param integer $value
1683
	 *
1684
	 * @throws MapperArgumentException
1685
	 *
1686
	 * @return void
1687
	 */
1688
	public function setClustersSize($value)
1689
	{
1690
		if (!is_integer($value)) {
1691
			throw new MapperArgumentException('Invalid map clusters size setting.');
1692
		}
1693
1694
		$this->clustersSize = $value;
1695
	}
1696
1697
	/**
1698
	 * Get map cluster size.
1699
	 *
1700
	 * @return integer
1701
	 */
1702
	public function getClustersSize()
1703
	{
1704
		return $this->clustersSize;
1705
	}
1706
1707
	/**
1708
	 * Get mapper options.
1709
	 *
1710
	 * @return array
1711
	 */
1712
	protected function getOptions()
1713
	{
1714
		return [
1715
			'key' => $this->getKey(),
1716
			'version' => $this->version,
1717
			'region' => $this->getRegion(),
1718
			'language' => $this->getLanguage(),
1719
			'async' => $this->getAsync(),
1720
			'marker' => $this->getMarker(),
1721
			'center' => $this->getCenter(),
1722
			'locate' => $this->getLocate(),
1723
			'zoom' => $this->getZoom(),
1724
			'scrollWheelZoom' => $this->getScrollWheelZoom(),
1725
			'fullscreenControl' => $this->getFullscreenControl(),
1726
			'zoomControl' => $this->getZoomControl(),
1727
			'scaleControl' => $this->getScaleControl(),
1728
			'streetViewControl' => $this->getStreetViewControl(),
1729
			'rotateControl' => $this->getRotateControl(),
1730
			'mapTypeControl' => $this->getMapTypeControl(),
1731
			'type' => $this->getType(),
1732
			'heading' => $this->getHeading(),
1733
			'tilt' => $this->getTilt(),
1734
			'ui' => $this->getUi(),
1735
			'overlay' => '',
1736
			'markers' => [
1737
				'title' => '',
1738
				'label' => '',
1739
				'content' => '',
1740
				'icon' => $this->getIcon(),
1741
				'place' => '',
1742
				'animation' => $this->getAnimation(),
1743
				'symbol' => '',
1744
			],
1745
			'cluster' => $this->getCluster(),
1746
			'clusters' => [
1747
				'icon' => $this->getClustersIcon(),
1748
				'grid' => $this->getClustersGrid(),
1749
				'zoom' => $this->getClustersZoom(),
1750
				'center' => $this->getClustersCenter(),
1751
				'size' => $this->getClustersSize()
1752
			],
1753
		];
1754
	}
1755
1756
	/**
1757
	 * Add mapping item.
1758
	 *
1759
	 * @param object $value
1760
	 *
1761
	 * @return void
1762
	 */
1763
	protected function addItem($value)
1764
	{
1765
		$this->items[] = $value;
1766
	}
1767
1768
	/**
1769
	 * Set mapping items.
1770
	 *
1771
	 * @param array $array
1772
	 *
1773
	 * @return void
1774
	 */
1775
	protected function setItems(array $array)
1776
	{
1777
		$this->items = $array;
1778
	}
1779
1780
	/**
1781
	 * Get the mapping items.
1782
	 *
1783
	 * @return array
1784
	 */
1785
	public function getItems()
1786
	{
1787
		return $this->items;
1788
	}
1789
1790
	/**
1791
	 * Get a mapping item by reference.
1792
	 *
1793
	 * @param integer $item
1794
	 *
1795
	 * @return array|boolean
1796
	 */
1797
	public function getItem($item)
1798
	{
1799
		return isset($this->items[$item]) ? $this->items[$item] : false;
1800
	}
1801
1802
}