Code Duplication    Length = 9-12 lines in 3 locations

app/Module/GoogleMapsModule.php 2 locations

@@ 1518-1529 (lines=12) @@
1515
				$par[$i] = 'unknown';
1516
			}
1517
			$placelist = $this->createPossiblePlaceNames($par[$i], $i + 1);
1518
			foreach ($placelist as $key => $placename) {
1519
				$pl_id = (int) Database::prepare(
1520
					"SELECT pl_id FROM `##placelocation` WHERE pl_level = :level AND pl_parent_id = :parent_id AND pl_place LIKE :placename"
1521
				)->execute([
1522
					'level'     => $i,
1523
					'parent_id' => $place_id,
1524
					'placename' => $placename,
1525
				])->fetchOne();
1526
				if ($pl_id) {
1527
					break;
1528
				}
1529
			}
1530
			if (!$pl_id) {
1531
				break;
1532
			}
@@ 1557-1568 (lines=12) @@
1554
		for ($i = 0; $i < $num_par; $i++) {
1555
			$par[$i]   = trim($par[$i]);
1556
			$placelist = $this->createPossiblePlaceNames($par[$i], $i + 1);
1557
			foreach ($placelist as $placename) {
1558
				$pl_id = (int) Database::prepare(
1559
					"SELECT p_id FROM `##places` WHERE p_parent_id = :place_id AND p_file = :tree_id AND p_place = :placename"
1560
				)->execute([
1561
					'place_id'  => $place_id,
1562
					'tree_id'   => $WT_TREE->getTreeId(),
1563
					'placename' => $placename,
1564
				])->fetchOne();
1565
				if ($pl_id) {
1566
					break;
1567
				}
1568
			}
1569
			if (!$pl_id) {
1570
				break;
1571
			}

app/Functions/FunctionsImport.php 1 location

@@ 1159-1167 (lines=9) @@
1156
		Database::prepare("DELETE FROM `##dates`      WHERE d_gid =? AND d_file =?")->execute([$gid, $ged_id]);
1157
1158
		//-- delete any unlinked places
1159
		foreach ($placeids as $p_id) {
1160
			$num =
1161
				Database::prepare("SELECT count(pl_p_id) FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?")
1162
					->execute([$p_id, $ged_id])
1163
					->fetchOne();
1164
			if ($num == 0) {
1165
				Database::prepare("DELETE FROM `##places` WHERE p_id=? AND p_file=?")->execute([$p_id, $ged_id]);
1166
			}
1167
		}
1168
1169
		Database::prepare("DELETE FROM `##name` WHERE n_id=? AND n_file=?")->execute([$gid, $ged_id]);
1170
		Database::prepare("DELETE FROM `##link` WHERE l_from=? AND l_file=?")->execute([$gid, $ged_id]);