197a7ec96SGreg Roach<?php 23976b470SGreg Roach 397a7ec96SGreg Roach/** 497a7ec96SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 697a7ec96SGreg Roach * This program is free software: you can redistribute it and/or modify 797a7ec96SGreg Roach * it under the terms of the GNU General Public License as published by 897a7ec96SGreg Roach * the Free Software Foundation, either version 3 of the License, or 997a7ec96SGreg Roach * (at your option) any later version. 1097a7ec96SGreg Roach * This program is distributed in the hope that it will be useful, 1197a7ec96SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1297a7ec96SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1397a7ec96SGreg Roach * GNU General Public License for more details. 1497a7ec96SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 1697a7ec96SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 1915d603e7SGreg Roach 2097a7ec96SGreg Roachnamespace Fisharebest\Webtrees\Census; 2197a7ec96SGreg Roach 228fb4e87cSGreg Roachuse Fisharebest\Webtrees\I18N; 2397a7ec96SGreg Roachuse Fisharebest\Webtrees\Individual; 2497a7ec96SGreg Roach 2597a7ec96SGreg Roach/** 2697a7ec96SGreg Roach * The individual's full name. 2797a7ec96SGreg Roach */ 28c1010edaSGreg Roachclass CensusColumnSurnameGivenNames extends AbstractCensusColumn implements CensusColumnInterface 29c1010edaSGreg Roach{ 3097a7ec96SGreg Roach /** 3197a7ec96SGreg Roach * Generate the likely value of this census column, based on available information. 3297a7ec96SGreg Roach * 3397a7ec96SGreg Roach * @param Individual $individual 3415d603e7SGreg Roach * @param Individual $head 3597a7ec96SGreg Roach * 3697a7ec96SGreg Roach * @return string 3797a7ec96SGreg Roach */ 388f53f488SRico Sonntag public function generate(Individual $individual, Individual $head): string 39c1010edaSGreg Roach { 4013488723SDavid Drury $name = $this->nameAtCensusDate($individual); 418fb4e87cSGreg Roach $surname = strtr($name['surname'], [Individual::NOMEN_NESCIO => I18N::translateContext('Unknown surname', '…')]); 428fb4e87cSGreg Roach $given_names = strtr($name['givn'], [Individual::PRAENOMEN_NESCIO => I18N::translateContext('Unknown given name', '…')]); 4397a7ec96SGreg Roach 448fb4e87cSGreg Roach return $surname . ', ' . $given_names; 4597a7ec96SGreg Roach } 4697a7ec96SGreg Roach} 47