xref: /webtrees/app/Elements/IndividualNonEvent.php (revision 5a8afed46297e8105e3e5a33ce37e6a8e88bc79d)
1a2143fbeSGreg Roach<?php
2a2143fbeSGreg Roach
3a2143fbeSGreg Roach/**
4a2143fbeSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6a2143fbeSGreg Roach * This program is free software: you can redistribute it and/or modify
7a2143fbeSGreg Roach * it under the terms of the GNU General Public License as published by
8a2143fbeSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9a2143fbeSGreg Roach * (at your option) any later version.
10a2143fbeSGreg Roach * This program is distributed in the hope that it will be useful,
11a2143fbeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12a2143fbeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13a2143fbeSGreg Roach * GNU General Public License for more details.
14a2143fbeSGreg Roach * You should have received a copy of the GNU General Public License
15a2143fbeSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16a2143fbeSGreg Roach */
17a2143fbeSGreg Roach
18a2143fbeSGreg Roachdeclare(strict_types=1);
19a2143fbeSGreg Roach
20a2143fbeSGreg Roachnamespace Fisharebest\Webtrees\Elements;
21a2143fbeSGreg Roach
22a2143fbeSGreg Roachuse Fisharebest\Webtrees\I18N;
23a2143fbeSGreg Roachuse Fisharebest\Webtrees\Registry;
24a2143fbeSGreg Roach
25a2143fbeSGreg Roachuse function strtoupper;
26a2143fbeSGreg Roach
27a2143fbeSGreg Roach/**
28a2143fbeSGreg Roach * An event which never happened.
29a2143fbeSGreg Roach */
30a2143fbeSGreg Roachclass IndividualNonEvent extends AbstractElement
31a2143fbeSGreg Roach{
32a2143fbeSGreg Roach    protected const SUBTAGS = [
33a2143fbeSGreg Roach        'DATE' => '0:1',
34a2143fbeSGreg Roach        'NOTE' => '0:1',
35a2143fbeSGreg Roach        'SOUR' => '0:1',
36a2143fbeSGreg Roach    ];
37a2143fbeSGreg Roach
38a2143fbeSGreg Roach    /**
39a2143fbeSGreg Roach     * Convert a value to a canonical form.
40a2143fbeSGreg Roach     *
41a2143fbeSGreg Roach     * @param string $value
42a2143fbeSGreg Roach     *
43a2143fbeSGreg Roach     * @return string
44a2143fbeSGreg Roach     */
45a2143fbeSGreg Roach    public function canonical(string $value): string
46a2143fbeSGreg Roach    {
47a2143fbeSGreg Roach        return strtoupper(parent::canonical($value));
48a2143fbeSGreg Roach    }
49a2143fbeSGreg Roach
50a2143fbeSGreg Roach    /**
51a2143fbeSGreg Roach     * A list of controlled values for this element
52a2143fbeSGreg Roach     *
53a2143fbeSGreg Roach     * @return array<int|string,string>
54a2143fbeSGreg Roach     */
55a2143fbeSGreg Roach    public function values(): array
56a2143fbeSGreg Roach    {
57a2143fbeSGreg Roach        $values = [
58a2143fbeSGreg Roach            ''     => '',
59a2143fbeSGreg Roach            'ADOP' => Registry::elementFactory()->make('INDI:ADOP')->label(),
60a2143fbeSGreg Roach            'BAPM' => Registry::elementFactory()->make('INDI:BAPM')->label(),
61a2143fbeSGreg Roach            'BARM' => Registry::elementFactory()->make('INDI:BARM')->label(),
62a2143fbeSGreg Roach            'BASM' => Registry::elementFactory()->make('INDI:BASM')->label(),
63a2143fbeSGreg Roach            'BIRT' => Registry::elementFactory()->make('INDI:BIRT')->label(),
64a2143fbeSGreg Roach            'BLES' => Registry::elementFactory()->make('INDI:BLES')->label(),
65a2143fbeSGreg Roach            'BURI' => Registry::elementFactory()->make('INDI:BURI')->label(),
66a2143fbeSGreg Roach            'CENS' => Registry::elementFactory()->make('INDI:CENS')->label(),
67a2143fbeSGreg Roach            'CHR'  => Registry::elementFactory()->make('INDI:CHR')->label(),
68a2143fbeSGreg Roach            'CHRA' => Registry::elementFactory()->make('INDI:CHRA')->label(),
69a2143fbeSGreg Roach            'CONF' => Registry::elementFactory()->make('INDI:CONF')->label(),
70a2143fbeSGreg Roach            'CREM' => Registry::elementFactory()->make('INDI:CREM')->label(),
71a2143fbeSGreg Roach            'DEAT' => Registry::elementFactory()->make('INDI:DEAT')->label(),
72a2143fbeSGreg Roach            'EMIG' => Registry::elementFactory()->make('INDI:EMIG')->label(),
73a2143fbeSGreg Roach            'FCOM' => Registry::elementFactory()->make('INDI:FCOM')->label(),
74a2143fbeSGreg Roach            'GRAD' => Registry::elementFactory()->make('INDI:GRAD')->label(),
75a2143fbeSGreg Roach            'IMMI' => Registry::elementFactory()->make('INDI:IMMI')->label(),
76a2143fbeSGreg Roach            'NATU' => Registry::elementFactory()->make('INDI:NATU')->label(),
77a2143fbeSGreg Roach            'ORDN' => Registry::elementFactory()->make('INDI:ORDN')->label(),
78a2143fbeSGreg Roach            'PROB' => Registry::elementFactory()->make('INDI:PROB')->label(),
79a2143fbeSGreg Roach            'RETI' => Registry::elementFactory()->make('INDI:RETI')->label(),
80a2143fbeSGreg Roach            'WILL' => Registry::elementFactory()->make('INDI:WILL')->label(),
81a2143fbeSGreg Roach        ];
82a2143fbeSGreg Roach
83a2143fbeSGreg Roach        uasort($values, I18N::comparator());
84a2143fbeSGreg Roach
85a2143fbeSGreg Roach        return $values;
86a2143fbeSGreg Roach    }
87a2143fbeSGreg Roach}
88