xref: /webtrees/app/Census/CensusColumnSexM.php (revision da3cb887318b253ac0a743309ac1b537880d6ba2)
1*da3cb887Sglarwill<?php
2*da3cb887Sglarwill
3*da3cb887Sglarwill/**
4*da3cb887Sglarwill * webtrees: online genealogy
5*da3cb887Sglarwill * Copyright (C) 2021 webtrees development team
6*da3cb887Sglarwill * This program is free software: you can redistribute it and/or modify
7*da3cb887Sglarwill * it under the terms of the GNU General Public License as published by
8*da3cb887Sglarwill * the Free Software Foundation, either version 3 of the License, or
9*da3cb887Sglarwill * (at your option) any later version.
10*da3cb887Sglarwill * This program is distributed in the hope that it will be useful,
11*da3cb887Sglarwill * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*da3cb887Sglarwill * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*da3cb887Sglarwill * GNU General Public License for more details.
14*da3cb887Sglarwill * You should have received a copy of the GNU General Public License
15*da3cb887Sglarwill * along with this program. If not, see <https://www.gnu.org/licenses/>.
16*da3cb887Sglarwill */
17*da3cb887Sglarwill
18*da3cb887Sglarwilldeclare(strict_types=1);
19*da3cb887Sglarwill
20*da3cb887Sglarwillnamespace Fisharebest\Webtrees\Census;
21*da3cb887Sglarwill
22*da3cb887Sglarwilluse Fisharebest\Webtrees\Individual;
23*da3cb887Sglarwill
24*da3cb887Sglarwill/**
25*da3cb887Sglarwill * The individual's sex Male?
26*da3cb887Sglarwill */
27*da3cb887Sglarwillclass CensusColumnSexM extends AbstractCensusColumn implements CensusColumnInterface
28*da3cb887Sglarwill{
29*da3cb887Sglarwill    protected const MALE = 'M';
30*da3cb887Sglarwill
31*da3cb887Sglarwill    protected const FEMALE = 'F';
32*da3cb887Sglarwill
33*da3cb887Sglarwill    protected const X = 'X';
34*da3cb887Sglarwill
35*da3cb887Sglarwill    /**
36*da3cb887Sglarwill     * Generate the likely value of this census column, based on available information.
37*da3cb887Sglarwill     * X is the value returned for this column as it is a selection of F column or M
38*da3cb887Sglarwill     * column.
39*da3cb887Sglarwill     *
40*da3cb887Sglarwill     * @param Individual $individual
41*da3cb887Sglarwill     * @param Individual $head
42*da3cb887Sglarwill     *
43*da3cb887Sglarwill     * @return string
44*da3cb887Sglarwill     */
45*da3cb887Sglarwill    public function generate(Individual $individual, Individual $head): string
46*da3cb887Sglarwill    {
47*da3cb887Sglarwill        switch ($individual->sex()) {
48*da3cb887Sglarwill            case 'M':
49*da3cb887Sglarwill                return static::X;
50*da3cb887Sglarwill            default:
51*da3cb887Sglarwill                return '';
52*da3cb887Sglarwill        }
53*da3cb887Sglarwill    }
54*da3cb887Sglarwill}
55