Code Duplication    Length = 5-5 lines in 3 locations

app/Module/GoogleMapsModule.php 3 locations

@@ 570-574 (lines=5) @@
567
		$country = array();
568
		if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags')) {
569
			$rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags');
570
			while ($file = readdir($rep)) {
571
				if (stristr($file, '.png')) {
572
					$country[] = substr($file, 0, strlen($file) - 4);
573
				}
574
			}
575
			closedir($rep);
576
			sort($country);
577
		}
@@ 585-589 (lines=5) @@
582
			$flags = array();
583
			if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags')) {
584
				$rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags');
585
				while ($file = readdir($rep)) {
586
					if (stristr($file, '.png')) {
587
						$flags[] = substr($file, 0, strlen($file) - 4);
588
					}
589
				}
590
				closedir($rep);
591
				sort($flags);
592
			}
@@ 597-601 (lines=5) @@
594
		$flags_s = array();
595
		if ($stateSelected != 'States' && is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected)) {
596
			$rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected);
597
			while ($file = readdir($rep)) {
598
				if (stristr($file, '.png')) {
599
					$flags_s[] = substr($file, 0, strlen($file) - 4);
600
				}
601
			}
602
			closedir($rep);
603
			sort($flags_s);
604
		}