Code Duplication    Length = 7-7 lines in 3 locations

app/Stats.php 3 locations

@@ 2292-2298 (lines=7) @@
2289
	 * @return string
2290
	 */
2291
	private function topTenOldestQuery($type = 'list', $sex = 'BOTH', $params = []) {
2292
		if ($sex === 'F') {
2293
			$sex_search = " AND i_sex='F' ";
2294
		} elseif ($sex === 'M') {
2295
			$sex_search = " AND i_sex='M' ";
2296
		} else {
2297
			$sex_search = '';
2298
		}
2299
		if (isset($params[0])) {
2300
			$total = (int) $params[0];
2301
		} else {
@@ 2378-2384 (lines=7) @@
2375
		if (!Auth::isMember($this->tree)) {
2376
			return I18N::translate('This information is private and cannot be shown.');
2377
		}
2378
		if ($sex == 'F') {
2379
			$sex_search = " AND i_sex='F'";
2380
		} elseif ($sex == 'M') {
2381
			$sex_search = " AND i_sex='M'";
2382
		} else {
2383
			$sex_search = '';
2384
		}
2385
		if (isset($params[0])) {
2386
			$total = (int) $params[0];
2387
		} else {
@@ 2451-2457 (lines=7) @@
2448
	 * @return string
2449
	 */
2450
	private function averageLifespanQuery($sex = 'BOTH', $show_years = false) {
2451
		if ($sex === 'F') {
2452
			$sex_search = " AND i_sex='F' ";
2453
		} elseif ($sex === 'M') {
2454
			$sex_search = " AND i_sex='M' ";
2455
		} else {
2456
			$sex_search = '';
2457
		}
2458
		$rows = $this->runSql(
2459
			"SELECT SQL_CACHE " .
2460
			" AVG(death.d_julianday2-birth.d_julianday1) AS age " .