Passed
Push — master ( 4d2b9c...c2ed51 )
by Greg
06:41
created

PedigreeLinkageType::values()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 29
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 36
rs 9.456
1
<?php
2
3
/**
4
 * webtrees: online genealogy
5
 * Copyright (C) 2021 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
18
declare(strict_types=1);
19
20
namespace Fisharebest\Webtrees\Elements;
21
22
use 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
 */
34
class PedigreeLinkageType extends AbstractElement
35
{
36
    protected const MAX_LENGTH = 7;
37
38
    /**
39
     * A list of controlled values for this element
40
     *
41
     * @param string $sex - the text depends on the sex of the individual
42
     *
43
     * @return array<int|string,string>
44
     */
45
    public function values(string $sex = 'U'): array
46
    {
47
        $values = [
48
            'M' => [
49
                ''        => '',
50
                'birth'   => I18N::translateContext('Male pedigree', 'Birth'),
51
                'adopted' => I18N::translateContext('Male pedigree', 'Adopted'),
52
                'foster'  => I18N::translateContext('Male pedigree', 'Foster'),
53
                'sealing' => /* I18N: “sealing” is a Mormon ceremony. */
54
                    I18N::translateContext('Male pedigree', 'Sealing'),
55
                'rada'    => /* I18N: “rada” is an Arabic word, pronounced “ra DAH”. It is child-to-parent pedigree, established by wet-nursing. */
56
                    I18N::translateContext('Male pedigree', 'Rada'),
57
            ],
58
            'F' => [
59
                ''        => '',
60
                'birth'   => I18N::translateContext('Female pedigree', 'Birth'),
61
                'adopted' => I18N::translateContext('Female pedigree', 'Adopted'),
62
                'foster'  => I18N::translateContext('Female pedigree', 'Foster'),
63
                'sealing' => /* I18N: “sealing” is a Mormon ceremony. */
64
                    I18N::translateContext('Female pedigree', 'Sealing'),
65
                'rada'    => /* I18N: “rada” is an Arabic word, pronounced “ra DAH”. It is child-to-parent pedigree, established by wet-nursing. */
66
                    I18N::translateContext('Female pedigree', 'Rada'),
67
            ],
68
            'U' => [
69
                ''        => '',
70
                'birth'   => I18N::translateContext('Pedigree', 'Birth'),
71
                'adopted' => I18N::translateContext('Pedigree', 'Adopted'),
72
                'foster'  => I18N::translateContext('Pedigree', 'Foster'),
73
                'sealing' => /* I18N: “sealing” is a Mormon ceremony. */
74
                    I18N::translateContext('Pedigree', 'Sealing'),
75
                'rada'    => /* I18N: “rada” is an Arabic word, pronounced “ra DAH”. It is child-to-parent pedigree, established by wet-nursing. */
76
                    I18N::translateContext('Pedigree', 'Rada'),
77
            ],
78
        ];
79
80
        return $values[$sex] ?? $values['U'];
81
    }
82
}
83