Code Duplication    Length = 21-21 lines in 2 locations

src/Map.php 2 locations

@@ 482-502 (lines=21) @@
479
				var polyline_plan_'.count($this->polylines).' = [';
480
            $i = 0;
481
            $lat_long_output = '';
482
            foreach ($polyline['points'] as $point) {
483
                if ($i > 0) {
484
                    $polyline_output .= ',';
485
                }
486
                $lat_long_to_push = '';
487
                if ($this->is_lat_long($point)) {
488
                    $lat_long_to_push = $point;
489
                    $polyline_output .= '
490
					new google.maps.LatLng('.$point.')
491
					';
492
                } else {
493
                    $lat_long = $this->get_lat_long_from_address($point);
494
                    $polyline_output .= '
495
					new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
496
                    $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
497
                }
498
                $lat_long_output .= '
499
					lat_longs_'.$this->map_name.'.push(new google.maps.LatLng('.$lat_long_to_push.'));
500
				';
501
                $i++;
502
            }
503
            $polyline_output .= '];';
504
505
            $polyline_output .= $lat_long_output;
@@ 623-643 (lines=21) @@
620
				var polygon_plan_'.count($this->polygons).' = [';
621
            $i = 0;
622
            $lat_long_output = '';
623
            foreach ($polygon['points'] as $point) {
624
                if ($i > 0) {
625
                    $polygon_output .= ',';
626
                }
627
                $lat_long_to_push = '';
628
                if ($this->is_lat_long($point)) {
629
                    $lat_long_to_push = $point;
630
                    $polygon_output .= '
631
					new google.maps.LatLng('.$point.')
632
					';
633
                } else {
634
                    $lat_long = $this->get_lat_long_from_address($point);
635
                    $polygon_output .= '
636
					new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
637
                    $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
638
                }
639
                $lat_long_output .= '
640
					lat_longs_'.$this->map_name.'.push(new google.maps.LatLng('.$lat_long_to_push.'));
641
				';
642
                $i++;
643
            }
644
            $polygon_output .= '];';
645
646
            $polygon_output .= $lat_long_output;