src/Webtrees/Module/PatronymicLineage/Model/LineageBuilder.php
protected function getLineageRootIndividual(Individual $indi) {
		$is_first=false;
		$dindi = new \MyArtJaub\Webtrees\Individual($indi);
		$indi_surname=$dindi->getUnprotectedPrimarySurname();
		$resIndi = $indi;
		while(!$is_first){
			//Get the individual parents family
			$fam=$resIndi->getPrimaryChildFamily();
			if($fam){
				$husb=$fam->getHusband();
				$wife=$fam->getWife();
				//If the father exists, take him
				if($husb){
					$dhusb = new \MyArtJaub\Webtrees\Individual($husb);
					$dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb;
				}
				//If only a mother exists
				else if($wife){
					$dwife = new \MyArtJaub\Webtrees\Individual($wife);
					$wife_surname=$dwife->getUnprotectedPrimarySurname();
					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
						$resIndi=$wife;
					}
					else{
						$is_first=true;
					}
				}
				else{
					$is_first=true;
				}
			}
			else{
				$is_first=true;
			}
		}
		if(isset($this->used_indis[$resIndi->getXref()])){
			return null;
		}
		else{
			return $resIndi;
		}
	}
protected function getLineageRootIndividual(Individual $indi) {
		$is_first=false;
		$dindi = new \MyArtJaub\Webtrees\Individual($indi);
		$indi_surname=$dindi->getUnprotectedPrimarySurname();
		$resIndi = $indi;
		while(!$is_first){
			//Get the individual parents family
			$fam=$resIndi->getPrimaryChildFamily();
			if($fam){
				$husb=$fam->getHusband();
				$wife=$fam->getWife();
				//If the father exists, take him
				if($husb){
					$dhusb = new \MyArtJaub\Webtrees\Individual($husb);
					$dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb;
				}
				//If only a mother exists
				else if($wife){
					$dwife = new \MyArtJaub\Webtrees\Individual($wife);
					$wife_surname=$dwife->getUnprotectedPrimarySurname();
					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
						$resIndi=$wife;
					}
					else{
						$is_first=true;
					}
				}
				else{
					$is_first=true;
				}
			}
			else{
				$is_first=true;
			}
		}
		if(isset($this->used_indis[$resIndi->getXref()])){
			return null;
		}
		else{
			return $resIndi;
		}
	}
protected function getLineageRootIndividual ( Individual $ indi ) { $ is_first = false ; $ dindi = new \ MyArtJaub \ Webtrees \ Individual ( $ indi ) ; $ indi_surname = $ dindi -> getUnprotectedPrimarySurname ( ) ; $ resIndi = $ indi ; while ( ! $ is_first ) { //Get the individual parents family $ fam = $ resIndi -> getPrimaryChildFamily ( ) ; if ( $ fam ) { $ husb = $ fam -> getHusband ( ) ; $ wife = $ fam -> getWife ( ) ; //If the father exists, take him if ( $ husb ) { $ dhusb = new \ MyArtJaub \ Webtrees \ Individual ( $ husb ) ; $ dhusb -> isNewAddition ( ) ? $ is_first = true : $ resIndi = $ husb ; } //If only a mother exists else if ( $ wife ) { $ dwife = new \ MyArtJaub \ Webtrees \ Individual ( $ wife ) ; $ wife_surname = $ dwife -> getUnprotectedPrimarySurname ( ) ; //Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical) if ( ! $ dwife -> isNewAddition ( ) && I18N :: strcasecmp ( $ wife_surname , $ indi_surname ) == 0 ) { $ resIndi = $ wife ; } else { $ is_first = true ; } } else { $ is_first = true ; } } else { $ is_first = true ; } } if ( isset ( $ this -> used_indis [ $ resIndi -> getXref ( ) ] ) ) { return null ; } else { return $ resIndi ; } }
Retrieve the root individual, from any individual.
The Root individual is the individual without a father, or without a mother holding the same name.

@param Individual $indi
@return (Individual|null) Root individual
Retrieve the root individual from any individual . The Root individual is the individual without a father or without a mother holding the same name .