xref: /webtrees/app/Census/CensusColumnBirthDaySlashMonth.php (revision b2ce94c6833c25934b40a7e6bc15985d50b5f42a)
14c219c47SGreg Roach<?php
24c219c47SGreg Roach/**
34c219c47SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
54c219c47SGreg Roach * This program is free software: you can redistribute it and/or modify
64c219c47SGreg Roach * it under the terms of the GNU General Public License as published by
74c219c47SGreg Roach * the Free Software Foundation, either version 3 of the License, or
84c219c47SGreg Roach * (at your option) any later version.
94c219c47SGreg Roach * This program is distributed in the hope that it will be useful,
104c219c47SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
114c219c47SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124c219c47SGreg Roach * GNU General Public License for more details.
134c219c47SGreg Roach * You should have received a copy of the GNU General Public License
144c219c47SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
154c219c47SGreg Roach */
1615d603e7SGreg Roach
174c219c47SGreg Roachnamespace Fisharebest\Webtrees\Census;
184c219c47SGreg Roach
194c219c47SGreg Roachuse Fisharebest\Webtrees\Individual;
204c219c47SGreg Roach
214c219c47SGreg Roach/**
224c219c47SGreg Roach * The individual's date of birth.
234c219c47SGreg Roach */
24c1010edaSGreg Roachclass CensusColumnBirthDaySlashMonth extends AbstractCensusColumn implements CensusColumnInterface
25c1010edaSGreg Roach{
264c219c47SGreg Roach    /**
274c219c47SGreg Roach     * Generate the likely value of this census column, based on available information.
284c219c47SGreg Roach     *
294c219c47SGreg Roach     * @param Individual $individual
3015d603e7SGreg Roach     * @param Individual $head
314c219c47SGreg Roach     *
324c219c47SGreg Roach     * @return string
334c219c47SGreg Roach     */
345a62e0a6SGreg Roach    public function generate(Individual $individual, Individual $head): string
35c1010edaSGreg Roach    {
364c219c47SGreg Roach        $birth_date = $individual->getBirthDate();
374c219c47SGreg Roach
384c219c47SGreg Roach        if ($birth_date->minimumJulianDay() === $birth_date->maximumJulianDay()) {
394c219c47SGreg Roach            return $birth_date->minimumDate()->format('%j/%n');
404c219c47SGreg Roach        }
41*b2ce94c6SRico Sonntag
42*b2ce94c6SRico Sonntag        return '';
434c219c47SGreg Roach    }
444c219c47SGreg Roach}
45