Passed
Push — 2.1 ( 161314...590228 )
by Greg
20:49 queued 14:49
created

IndividualNonEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 31
c 1
b 0
f 0
dl 0
loc 57
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canonical() 0 3 1
A values() 0 31 1
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
18
declare(strict_types=1);
19
20
namespace Fisharebest\Webtrees\Elements;
21
22
use Fisharebest\Webtrees\I18N;
23
24
use Fisharebest\Webtrees\Registry;
25
26
use function strtoupper;
27
28
/**
29
 * An event which never happened.
30
 */
31
class IndividualNonEvent extends AbstractElement
32
{
33
    protected const SUBTAGS = [
34
        'DATE' => '0:1',
35
        'NOTE' => '0:1',
36
        'SOUR' => '0:1',
37
    ];
38
39
40
    /**
41
     * Convert a value to a canonical form.
42
     *
43
     * @param string $value
44
     *
45
     * @return string
46
     */
47
    public function canonical(string $value): string
48
    {
49
        return strtoupper(parent::canonical($value));
50
    }
51
52
    /**
53
     * A list of controlled values for this element
54
     *
55
     * @return array<int|string,string>
56
     */
57
    public function values(): array
58
    {
59
        $values = [
60
            ''     => '',
61
            'ADOP' => Registry::elementFactory()->make('INDI:ADOP')->label(),
62
            'BAPM' => Registry::elementFactory()->make('INDI:BAPM')->label(),
63
            'BARM' => Registry::elementFactory()->make('INDI:BARM')->label(),
64
            'BASM' => Registry::elementFactory()->make('INDI:BASM')->label(),
65
            'BIRT' => Registry::elementFactory()->make('INDI:BIRT')->label(),
66
            'BLES' => Registry::elementFactory()->make('INDI:BLES')->label(),
67
            'BURI' => Registry::elementFactory()->make('INDI:BURI')->label(),
68
            'CENS' => Registry::elementFactory()->make('INDI:CENS')->label(),
69
            'CHR'  => Registry::elementFactory()->make('INDI:CHR')->label(),
70
            'CHRA' => Registry::elementFactory()->make('INDI:CHRA')->label(),
71
            'CONF' => Registry::elementFactory()->make('INDI:CONF')->label(),
72
            'CREM' => Registry::elementFactory()->make('INDI:CREM')->label(),
73
            'DEAT' => Registry::elementFactory()->make('INDI:DEAT')->label(),
74
            'EMIG' => Registry::elementFactory()->make('INDI:EMIG')->label(),
75
            'FCOM' => Registry::elementFactory()->make('INDI:FCOM')->label(),
76
            'GRAD' => Registry::elementFactory()->make('INDI:GRAD')->label(),
77
            'IMMI' => Registry::elementFactory()->make('INDI:IMMI')->label(),
78
            'NATU' => Registry::elementFactory()->make('INDI:NATU')->label(),
79
            'ORDN' => Registry::elementFactory()->make('INDI:ORDN')->label(),
80
            'PROB' => Registry::elementFactory()->make('INDI:PROB')->label(),
81
            'RETI' => Registry::elementFactory()->make('INDI:RETI')->label(),
82
            'WILL' => Registry::elementFactory()->make('INDI:WILL')->label(),
83
        ];
84
85
        uasort($values, I18N::comparator());
86
87
        return $values;
88
    }
89
}
90