Code Duplication    Length = 24-26 lines in 2 locations

app/Functions/FunctionsPrintLists.php 2 locations

@@ 1471-1494 (lines=24) @@
1468
		$filter          = 0;
1469
		$filtered_events = [];
1470
1471
		foreach (FunctionsDb::getEventsList($startjd, $endjd, $events, $WT_TREE) as $fact) {
1472
			$record = $fact->getParent();
1473
			// Only living people ?
1474
			if ($only_living) {
1475
				if ($record instanceof Individual && $record->isDead()) {
1476
					$filter++;
1477
					continue;
1478
				}
1479
				if ($record instanceof Family) {
1480
					$husb = $record->getHusband();
1481
					if (is_null($husb) || $husb->isDead()) {
1482
						$filter++;
1483
						continue;
1484
					}
1485
					$wife = $record->getWife();
1486
					if (is_null($wife) || $wife->isDead()) {
1487
						$filter++;
1488
						continue;
1489
					}
1490
				}
1491
			}
1492
1493
			$filtered_events[] = $fact;
1494
		}
1495
1496
		if (!empty($filtered_events)) {
1497
			$html .= '<table id="' . $table_id . '" class="width100">';
@@ 1576-1601 (lines=26) @@
1573
		$filter          = 0;
1574
		$filtered_events = [];
1575
		$html            = '';
1576
		foreach (FunctionsDb::getEventsList($startjd, $endjd, $events, $WT_TREE) as $fact) {
1577
			$record = $fact->getParent();
1578
			// only living people ?
1579
			if ($only_living) {
1580
				if ($record instanceof Individual && $record->isDead()) {
1581
					$filter++;
1582
					continue;
1583
				}
1584
				if ($record instanceof Family) {
1585
					$husb = $record->getHusband();
1586
					if (is_null($husb) || $husb->isDead()) {
1587
						$filter++;
1588
						continue;
1589
					}
1590
					$wife = $record->getWife();
1591
					if (is_null($wife) || $wife->isDead()) {
1592
						$filter++;
1593
						continue;
1594
					}
1595
				}
1596
			}
1597
1598
			$output++;
1599
1600
			$filtered_events[] = $fact;
1601
		}
1602
1603
		// Now we've filtered the list, we can sort by event, if required
1604
		switch ($sort_by) {