Code Duplication    Length = 35-35 lines in 2 locations

app/Functions/Functions.php 2 locations

@@ 360-394 (lines=35) @@
357
			if ($maxlength == 0 || count($node['path']) <= $maxlength) {
358
				$indi = $node['indi'];
359
				//-- check all parents and siblings of this node
360
				foreach ($indi->getChildFamilies(Auth::PRIV_HIDE) as $family) {
361
					$visited[$family->getXref()] = true;
362
					foreach ($family->getSpouses(Auth::PRIV_HIDE) as $spouse) {
363
						if (!isset($visited[$spouse->getXref()])) {
364
							$node1 = $node;
365
							$node1['length']++;
366
							$node1['path'][]      = $spouse;
367
							$node1['indi']        = $spouse;
368
							$node1['relations'][] = $parent_codes[$spouse->getSex()];
369
							$p1nodes[]            = $node1;
370
							if ($spouse === $person2) {
371
								$found   = true;
372
								$resnode = $node1;
373
							} else {
374
								$visited[$spouse->getXref()] = true;
375
							}
376
						}
377
					}
378
					foreach ($family->getChildren(Auth::PRIV_HIDE) as $child) {
379
						if (!isset($visited[$child->getXref()])) {
380
							$node1 = $node;
381
							$node1['length']++;
382
							$node1['path'][]      = $child;
383
							$node1['indi']        = $child;
384
							$node1['relations'][] = $sibling_codes[$child->getSex()];
385
							$p1nodes[]            = $node1;
386
							if ($child === $person2) {
387
								$found   = true;
388
								$resnode = $node1;
389
							} else {
390
								$visited[$child->getXref()] = true;
391
							}
392
						}
393
					}
394
				}
395
				//-- check all spouses and children of this node
396
				foreach ($indi->getSpouseFamilies(Auth::PRIV_HIDE) as $family) {
397
					$visited[$family->getXref()] = true;
@@ 396-430 (lines=35) @@
393
					}
394
				}
395
				//-- check all spouses and children of this node
396
				foreach ($indi->getSpouseFamilies(Auth::PRIV_HIDE) as $family) {
397
					$visited[$family->getXref()] = true;
398
					foreach ($family->getSpouses(Auth::PRIV_HIDE) as $spouse) {
399
						if (!in_array($spouse->getXref(), $node1) || !isset($visited[$spouse->getXref()])) {
400
							$node1 = $node;
401
							$node1['length']++;
402
							$node1['path'][]      = $spouse;
403
							$node1['indi']        = $spouse;
404
							$node1['relations'][] = $spouse_codes[$spouse->getSex()];
405
							$p1nodes[]            = $node1;
406
							if ($spouse === $person2) {
407
								$found   = true;
408
								$resnode = $node1;
409
							} else {
410
								$visited[$spouse->getXref()] = true;
411
							}
412
						}
413
					}
414
					foreach ($family->getChildren(Auth::PRIV_HIDE) as $child) {
415
						if (!isset($visited[$child->getXref()])) {
416
							$node1 = $node;
417
							$node1['length']++;
418
							$node1['path'][]      = $child;
419
							$node1['indi']        = $child;
420
							$node1['relations'][] = $child_codes[$child->getSex()];
421
							$p1nodes[]            = $node1;
422
							if ($child === $person2) {
423
								$found   = true;
424
								$resnode = $node1;
425
							} else {
426
								$visited[$child->getXref()] = true;
427
							}
428
						}
429
					}
430
				}
431
			}
432
			unset($p1nodes[$shortest]);
433
		}