Code Duplication    Length = 7-8 lines in 2 locations

app/Controller/GedcomRecordController.php 2 locations

@@ 55-61 (lines=7) @@
52
		// Automatically fix broken links
53
		if ($this->record && $this->record->canEdit()) {
54
			$broken_links = 0;
55
			foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
56
				if (!$fact->isPendingDeletion() && $fact->getTarget() === null) {
57
					$this->record->deleteFact($fact->getFactId(), false);
58
					FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
59
					$broken_links = true;
60
				}
61
			}
62
			foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
63
				// These can be links or inline. Only delete links.
64
				if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
@@ 62-69 (lines=8) @@
59
					$broken_links = true;
60
				}
61
			}
62
			foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
63
				// These can be links or inline. Only delete links.
64
				if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
65
					$this->record->deleteFact($fact->getFactId(), false);
66
					FlashMessages::addMessage(/* I18N: %s are names of records, such as sources, repositories or individuals */ I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
67
					$broken_links = true;
68
				}
69
			}
70
			if ($broken_links) {
71
				// Reload the updated family
72
				$this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree());