app/Census/CensusColumnFullName.php
protected function nameAtCensusDate(Individual $individual, Date $census_date): array
    {
        $names = $individual->getAllNames();
        $name  = $names[0];

        foreach ($individual->spouseFamilies() as $family) {
            foreach ($family->facts(['MARR']) as $marriage) {
                if ($marriage->date()->isOK() && Date::compare($marriage->date(), $census_date) < 0) {
                    $spouse = $family->spouse($individual);
                    foreach ($names as $individual_name) {
                        foreach ($spouse->getAllNames() as $spouse_name) {
                            if ($individual_name['type'] === '_MARNM' && $individual_name['surn'] === $spouse_name['surn']) {
                                return $individual_name;
                            }
                        }
                    }
                }
            }
        }

        return $name;
    }
protected function nameAtCensusDate(Individual $individual, Date $census_date): array
    {
        $names = $individual->getAllNames();
        $name  = $names[0];

        foreach ($individual->spouseFamilies() as $family) {
            foreach ($family->facts(['MARR']) as $marriage) {
                if ($marriage->date()->isOK() && Date::compare($marriage->date(), $census_date) < 0) {
                    $spouse = $family->spouse($individual);
                    foreach ($names as $individual_name) {
                        foreach ($spouse->getAllNames() as $spouse_name) {
                            if ($individual_name['type'] === '_MARNM' && $individual_name['surn'] === $spouse_name['surn']) {
                                return $individual_name;
                            }
                        }
                    }
                }
            }
        }

        return $name;
    }
protected function nameAtCensusDate ( Individual $ individual , Date $ census_date ) : array { $ names = $ individual -> getAllNames ( ) ; $ name = $ names [ 0 ] ; foreach ( $ individual -> spouseFamilies ( ) as $ family ) { foreach ( $ family -> facts ( [ 'MARR' ] ) as $ marriage ) { if ( $ marriage -> date ( ) -> isOK ( ) && Date :: compare ( $ marriage -> date ( ) , $ census_date ) < 0 ) { $ spouse = $ family -> spouse ( $ individual ) ; foreach ( $ names as $ individual_name ) { foreach ( $ spouse -> getAllNames ( ) as $ spouse_name ) { if ( $ individual_name [ 'type' ] === '_MARNM' && $ individual_name [ 'surn' ] === $ spouse_name [ 'surn' ] ) { return $ individual_name ; } } } } } } return $ name ; }
What was an individual's likely name on a given date, allowing
for marriages and married names.

@param Individual $individual
@param Date       $census_date

@return string[]
What was an individual s likely name on a given date allowing for marriages and married names .