xref: /webtrees/app/Elements/PedigreeLinkageType.php (revision 12224cf3303882855b8ef05670154f0131dbc4f0)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2022 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Elements;
21
22use Fisharebest\Webtrees\I18N;
23
24/**
25 * PEDIGREE_LINKAGE_TYPE := {Size=5:7}
26 * [ adopted | birth | foster | sealing ]
27 * A code used to indicate the child to family relationship for pedigree navigation purposes.
28 * Where:
29 * adopted = indicates adoptive parents.
30 * birth   = indicates birth parents.
31 * foster  = indicates child was included in a foster or guardian family.
32 * sealing = indicates child was sealed to parents other than birth parents.
33 */
34class PedigreeLinkageType extends AbstractElement
35{
36    protected const MAXIMUM_LENGTH = 7;
37
38    public const TYPE_ADOPTED = 'adopted';
39    public const TYPE_BIRTH   = 'birth';
40    public const TYPE_FOSTER  = 'foster';
41    public const TYPE_SEALING = 'sealing';
42    public const TYPE_RADA    = 'rada';
43
44    /**
45     * A list of controlled values for this element
46     *
47     * @param string $sex - the text depends on the sex of the individual
48     *
49     * @return array<int|string,string>
50     */
51    public function values(string $sex = 'U'): array
52    {
53        $values = [
54            'M' => [
55                ''        => '',
56                self::TYPE_BIRTH   => I18N::translateContext('Male pedigree', 'Birth'),
57                self::TYPE_ADOPTED => I18N::translateContext('Male pedigree', 'Adopted'),
58                self::TYPE_FOSTER  => I18N::translateContext('Male pedigree', 'Foster'),
59                /* I18N: “sealing” is a Mormon ceremony. */
60                self::TYPE_SEALING => I18N::translateContext('Male pedigree', 'Sealing'),
61                /* I18N: “rada” is an Arabic word, pronounced “ra DAH”. It is child-to-parent pedigree, established by wet-nursing. */
62                self::TYPE_RADA    => I18N::translateContext('Male pedigree', 'Rada'),
63            ],
64            'F' => [
65                ''        => '',
66                self::TYPE_BIRTH   => I18N::translateContext('Female pedigree', 'Birth'),
67                self::TYPE_ADOPTED => I18N::translateContext('Female pedigree', 'Adopted'),
68                self::TYPE_FOSTER  => I18N::translateContext('Female pedigree', 'Foster'),
69                /* I18N: “sealing” is a Mormon ceremony. */
70                self::TYPE_SEALING => I18N::translateContext('Female pedigree', 'Sealing'),
71                /* I18N: “rada” is an Arabic word, pronounced “ra DAH”. It is child-to-parent pedigree, established by wet-nursing. */
72                self::TYPE_RADA    => I18N::translateContext('Female pedigree', 'Rada'),
73            ],
74            'U' => [
75                ''        => '',
76                self::TYPE_BIRTH   => I18N::translateContext('Pedigree', 'Birth'),
77                self::TYPE_ADOPTED => I18N::translateContext('Pedigree', 'Adopted'),
78                self::TYPE_FOSTER  => I18N::translateContext('Pedigree', 'Foster'),
79                /* I18N: “sealing” is a Mormon ceremony. */
80                self::TYPE_SEALING => I18N::translateContext('Pedigree', 'Sealing'),
81                /* I18N: “rada” is an Arabic word, pronounced “ra DAH”. It is child-to-parent pedigree, established by wet-nursing. */
82                self::TYPE_RADA    => I18N::translateContext('Pedigree', 'Rada'),
83            ],
84        ];
85
86        return $values[$sex] ?? $values['U'];
87    }
88}
89