Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like MapperBase often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use MapperBase, and based on these observations, apply Extract Interface, too.
1 | <?php namespace Cornford\Googlmapper; |
||
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 = []) |
||
770 | |||
771 | /** |
||
772 | * Is mapping enabled? |
||
773 | * |
||
774 | * @return boolean |
||
775 | */ |
||
776 | public function isEnabled() |
||
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) |
||
798 | |||
799 | /** |
||
800 | * Get the enabled status. |
||
801 | * |
||
802 | * @return boolean |
||
803 | */ |
||
804 | protected function getEnabled() |
||
808 | |||
809 | /** |
||
810 | * Enable mapping. |
||
811 | * |
||
812 | * @return void |
||
813 | */ |
||
814 | public function enableMapping() |
||
818 | |||
819 | /** |
||
820 | * Disable mapping. |
||
821 | * |
||
822 | * @return void |
||
823 | */ |
||
824 | public function disableMapping() |
||
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) |
||
846 | |||
847 | /** |
||
848 | * Get the Google Maps key. |
||
849 | * |
||
850 | * @return string |
||
851 | */ |
||
852 | public function getKey() |
||
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) |
|
878 | |||
879 | /** |
||
880 | * Get the Google Maps region. |
||
881 | * |
||
882 | * @return string |
||
883 | */ |
||
884 | public function getRegion() |
||
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) |
|
910 | |||
911 | /** |
||
912 | * Get the Google Maps language. |
||
913 | * |
||
914 | * @return string |
||
915 | */ |
||
916 | public function getLanguage() |
||
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) |
||
938 | |||
939 | /** |
||
940 | * Get the map async status. |
||
941 | * |
||
942 | * @return boolean |
||
943 | */ |
||
944 | public function getAsync() |
||
948 | |||
949 | /** |
||
950 | * Enable async for maps. |
||
951 | * |
||
952 | * @return void |
||
953 | */ |
||
954 | public function enableAsync() |
||
958 | |||
959 | /** |
||
960 | * Disable async for maps. |
||
961 | * |
||
962 | * @return void |
||
963 | */ |
||
964 | public function disableAsync() |
||
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) |
||
986 | |||
987 | /** |
||
988 | * Get the map user status. |
||
989 | * |
||
990 | * @return boolean |
||
991 | */ |
||
992 | public function getUser() |
||
996 | |||
997 | /** |
||
998 | * Enable users for maps. |
||
999 | * |
||
1000 | * @return void |
||
1001 | */ |
||
1002 | public function enableUsers() |
||
1006 | |||
1007 | /** |
||
1008 | * Disable users for maps. |
||
1009 | * |
||
1010 | * @return void |
||
1011 | */ |
||
1012 | public function disableUsers() |
||
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) |
||
1034 | |||
1035 | /** |
||
1036 | * Get the marker status. |
||
1037 | * |
||
1038 | * @return boolean |
||
1039 | */ |
||
1040 | public function getMarker() |
||
1044 | |||
1045 | /** |
||
1046 | * Enable markers for maps. |
||
1047 | * |
||
1048 | * @return void |
||
1049 | */ |
||
1050 | public function enableMarkers() |
||
1054 | |||
1055 | /** |
||
1056 | * Disable markers for maps. |
||
1057 | * |
||
1058 | * @return void |
||
1059 | */ |
||
1060 | public function disableMarkers() |
||
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) |
||
1082 | |||
1083 | /** |
||
1084 | * Get the map center status. |
||
1085 | * |
||
1086 | * @return boolean |
||
1087 | */ |
||
1088 | public function getCenter() |
||
1092 | |||
1093 | /** |
||
1094 | * Enable center of maps. |
||
1095 | * |
||
1096 | * @return void |
||
1097 | */ |
||
1098 | public function enableCenter() |
||
1102 | |||
1103 | /** |
||
1104 | * Disable center of maps. |
||
1105 | * |
||
1106 | * @return void |
||
1107 | */ |
||
1108 | public function disableCenter() |
||
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) |
||
1130 | |||
1131 | /** |
||
1132 | * Get the map locate user status. |
||
1133 | * |
||
1134 | * @return boolean |
||
1135 | */ |
||
1136 | public function getLocate() |
||
1140 | |||
1141 | /** |
||
1142 | * Enable locate user position on maps. |
||
1143 | * |
||
1144 | * @return void |
||
1145 | */ |
||
1146 | public function enableLocate() |
||
1150 | |||
1151 | /** |
||
1152 | * Disable locate user position on maps. |
||
1153 | * |
||
1154 | * @return void |
||
1155 | */ |
||
1156 | public function disableLocate() |
||
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) |
||
1178 | |||
1179 | /** |
||
1180 | * Get the map UI status. |
||
1181 | * |
||
1182 | * @return boolean |
||
1183 | */ |
||
1184 | public function getUi() |
||
1188 | |||
1189 | /** |
||
1190 | * Enable maps ui. |
||
1191 | * |
||
1192 | * @return void |
||
1193 | */ |
||
1194 | public function enableUi() |
||
1198 | |||
1199 | /** |
||
1200 | * Disable maps ui. |
||
1201 | * |
||
1202 | * @return void |
||
1203 | */ |
||
1204 | public function disableUi() |
||
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) |
||
1230 | |||
1231 | /** |
||
1232 | * Get map zoom level. |
||
1233 | * |
||
1234 | * @return integer |
||
1235 | */ |
||
1236 | public function getZoom() |
||
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) |
||
1258 | |||
1259 | /** |
||
1260 | * Get map scroll wheel zoom. |
||
1261 | * |
||
1262 | * @return boolean |
||
1263 | */ |
||
1264 | public function getScrollWheelZoom() |
||
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) |
||
1286 | |||
1287 | /** |
||
1288 | * Get map zoom control. |
||
1289 | * |
||
1290 | * @return boolean |
||
1291 | */ |
||
1292 | public function getZoomControl() |
||
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) |
||
1314 | |||
1315 | /** |
||
1316 | * Get map type control. |
||
1317 | * |
||
1318 | * @return boolean |
||
1319 | */ |
||
1320 | public function getMapTypeControl() |
||
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) |
||
1342 | |||
1343 | /** |
||
1344 | * Get map scale control. |
||
1345 | * |
||
1346 | * @return boolean |
||
1347 | */ |
||
1348 | public function getScaleControl() |
||
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) |
||
1370 | |||
1371 | /** |
||
1372 | * Get map street view control. |
||
1373 | * |
||
1374 | * @return boolean |
||
1375 | */ |
||
1376 | public function getStreetViewControl() |
||
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) |
||
1398 | |||
1399 | /** |
||
1400 | * Get map rotate control. |
||
1401 | * |
||
1402 | * @return boolean |
||
1403 | */ |
||
1404 | public function getRotateControl() |
||
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) |
||
1426 | |||
1427 | /** |
||
1428 | * Get map fullscreen control. |
||
1429 | * |
||
1430 | * @return boolean |
||
1431 | */ |
||
1432 | public function getFullscreenControl() |
||
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) |
||
1454 | |||
1455 | /** |
||
1456 | * Get map type. |
||
1457 | * |
||
1458 | * @return string |
||
1459 | */ |
||
1460 | public function getType() |
||
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) |
||
1482 | |||
1483 | /** |
||
1484 | * Get map heading. |
||
1485 | * |
||
1486 | * @return integer |
||
1487 | */ |
||
1488 | public function getHeading() |
||
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) |
||
1510 | |||
1511 | /** |
||
1512 | * Get map tilt. |
||
1513 | * |
||
1514 | * @return integer |
||
1515 | */ |
||
1516 | public function getTilt() |
||
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) |
||
1538 | |||
1539 | /** |
||
1540 | * Get map marker icon. |
||
1541 | * |
||
1542 | * @return string |
||
1543 | */ |
||
1544 | public function getIcon() |
||
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) |
||
1566 | |||
1567 | /** |
||
1568 | * Get map marker animation. |
||
1569 | * |
||
1570 | * @return string |
||
1571 | */ |
||
1572 | public function getAnimation() |
||
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) |
||
1594 | |||
1595 | /** |
||
1596 | * Get the cluster status. |
||
1597 | * |
||
1598 | * @return boolean |
||
1599 | */ |
||
1600 | public function getCluster() |
||
1604 | |||
1605 | /** |
||
1606 | * Enable cluster. |
||
1607 | * |
||
1608 | * @return void |
||
1609 | */ |
||
1610 | public function enableCluster() |
||
1614 | |||
1615 | /** |
||
1616 | * Disable cluster. |
||
1617 | * |
||
1618 | * @return void |
||
1619 | */ |
||
1620 | public function disableCluster() |
||
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) |
||
1642 | |||
1643 | /** |
||
1644 | * Get map clusters icon. |
||
1645 | * |
||
1646 | * @return string |
||
1647 | */ |
||
1648 | public function getClustersIcon() |
||
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) |
||
1670 | |||
1671 | /** |
||
1672 | * Get map cluster grid. |
||
1673 | * |
||
1674 | * @return integer |
||
1675 | */ |
||
1676 | public function getClustersGrid() |
||
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) |
||
1698 | |||
1699 | /** |
||
1700 | * Get map cluster grid. |
||
1701 | * |
||
1702 | * @return integer|null |
||
1703 | */ |
||
1704 | public function getClustersZoom() |
||
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) |
||
1726 | |||
1727 | /** |
||
1728 | * Get map cluster center. |
||
1729 | * |
||
1730 | * @return boolean |
||
1731 | */ |
||
1732 | public function getClustersCenter() |
||
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) |
||
1754 | |||
1755 | /** |
||
1756 | * Get map cluster size. |
||
1757 | * |
||
1758 | * @return integer |
||
1759 | */ |
||
1760 | public function getClustersSize() |
||
1764 | |||
1765 | /** |
||
1766 | * Get mapper options. |
||
1767 | * |
||
1768 | * @return array |
||
1769 | */ |
||
1770 | protected function getOptions() |
||
1814 | |||
1815 | /** |
||
1816 | * Add mapping item. |
||
1817 | * |
||
1818 | * @param object $value |
||
1819 | * |
||
1820 | * @return void |
||
1821 | */ |
||
1822 | protected function addItem($value) |
||
1826 | |||
1827 | /** |
||
1828 | * Set mapping items. |
||
1829 | * |
||
1830 | * @param array $array |
||
1831 | * |
||
1832 | * @return void |
||
1833 | */ |
||
1834 | protected function setItems(array $array) |
||
1838 | |||
1839 | /** |
||
1840 | * Get the mapping items. |
||
1841 | * |
||
1842 | * @return array |
||
1843 | */ |
||
1844 | public function getItems() |
||
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) |
||
1860 | |||
1861 | } |
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.