xref: /webtrees/app/Census/CensusColumnSurnameGivenNames.php (revision 97a7ec96ccdc579b2572f04623805d1f5fee9fe5)
1*97a7ec96SGreg Roach<?php
2*97a7ec96SGreg Roach/**
3*97a7ec96SGreg Roach * webtrees: online genealogy
4*97a7ec96SGreg Roach * Copyright (C) 2015 webtrees development team
5*97a7ec96SGreg Roach * This program is free software: you can redistribute it and/or modify
6*97a7ec96SGreg Roach * it under the terms of the GNU General Public License as published by
7*97a7ec96SGreg Roach * the Free Software Foundation, either version 3 of the License, or
8*97a7ec96SGreg Roach * (at your option) any later version.
9*97a7ec96SGreg Roach * This program is distributed in the hope that it will be useful,
10*97a7ec96SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*97a7ec96SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12*97a7ec96SGreg Roach * GNU General Public License for more details.
13*97a7ec96SGreg Roach * You should have received a copy of the GNU General Public License
14*97a7ec96SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15*97a7ec96SGreg Roach */
16*97a7ec96SGreg Roachnamespace Fisharebest\Webtrees\Census;
17*97a7ec96SGreg Roach
18*97a7ec96SGreg Roachuse Fisharebest\Webtrees\Individual;
19*97a7ec96SGreg Roach
20*97a7ec96SGreg Roach/**
21*97a7ec96SGreg Roach * The individual's full name.
22*97a7ec96SGreg Roach */
23*97a7ec96SGreg Roachclass CensusColumnSurnameGivenNames extends AbstractCensusColumn implements CensusColumnInterface {
24*97a7ec96SGreg Roach	/**
25*97a7ec96SGreg Roach	 * Generate the likely value of this census column, based on available information.
26*97a7ec96SGreg Roach	 *
27*97a7ec96SGreg Roach	 * @param Individual      $individual
28*97a7ec96SGreg Roach	 * @param Individual|null $head
29*97a7ec96SGreg Roach	 *
30*97a7ec96SGreg Roach	 * @return string
31*97a7ec96SGreg Roach	 */
32*97a7ec96SGreg Roach	public function generate(Individual $individual, Individual $head = null) {
33*97a7ec96SGreg Roach		foreach ($individual->getAllNames() as $name) {
34*97a7ec96SGreg Roach			return $name['surn'] . ', ' . $name['givn'];
35*97a7ec96SGreg Roach		}
36*97a7ec96SGreg Roach
37*97a7ec96SGreg Roach		return '';
38*97a7ec96SGreg Roach	}
39*97a7ec96SGreg Roach}
40