xref: /webtrees/app/Elements/LdsOrdinanceStatus.php (revision d11be7027e34e3121be11cc025421873364403f9)
1701f5d18SGreg Roach<?php
2701f5d18SGreg Roach
3701f5d18SGreg Roach/**
4701f5d18SGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6701f5d18SGreg Roach * This program is free software: you can redistribute it and/or modify
7701f5d18SGreg Roach * it under the terms of the GNU General Public License as published by
8701f5d18SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9701f5d18SGreg Roach * (at your option) any later version.
10701f5d18SGreg Roach * This program is distributed in the hope that it will be useful,
11701f5d18SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12701f5d18SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13701f5d18SGreg Roach * GNU General Public License for more details.
14701f5d18SGreg Roach * You should have received a copy of the GNU General Public License
15701f5d18SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16701f5d18SGreg Roach */
17701f5d18SGreg Roach
18701f5d18SGreg Roachdeclare(strict_types=1);
19701f5d18SGreg Roach
20701f5d18SGreg Roachnamespace Fisharebest\Webtrees\Elements;
21701f5d18SGreg Roach
22701f5d18SGreg Roachuse Fisharebest\Webtrees\I18N;
23701f5d18SGreg Roach
24701f5d18SGreg Roachuse function strtoupper;
25701f5d18SGreg Roach
26701f5d18SGreg Roach/**
27701f5d18SGreg Roach * g7:ord-STAT
28701f5d18SGreg Roach */
29701f5d18SGreg Roachclass LdsOrdinanceStatus extends AbstractElement
30701f5d18SGreg Roach{
31701f5d18SGreg Roach    private const CORRECTIONS = [
32701f5d18SGreg Roach        // PhpGedView misspells this tag.
33701f5d18SGreg Roach        'CANCELLED' => 'CANCELED',
34701f5d18SGreg Roach        // GEDCOM 5.5.1
35701f5d18SGreg Roach        'DNS/CAN'   => 'DNS_CAN',
36701f5d18SGreg Roach        'PRE-1970'  => 'PRE_1970',
37701f5d18SGreg Roach    ];
38701f5d18SGreg Roach
39701f5d18SGreg Roach    /**
40701f5d18SGreg Roach     * Convert a value to a canonical form.
41701f5d18SGreg Roach     *
42701f5d18SGreg Roach     * @param string $value
43701f5d18SGreg Roach     *
44701f5d18SGreg Roach     * @return string
45701f5d18SGreg Roach     */
46701f5d18SGreg Roach    public function canonical(string $value): string
47701f5d18SGreg Roach    {
48701f5d18SGreg Roach        return strtr(strtoupper(parent::canonical($value)), self::CORRECTIONS);
49701f5d18SGreg Roach    }
50701f5d18SGreg Roach
51701f5d18SGreg Roach    /**
52701f5d18SGreg Roach     * A list of controlled values for this element
53701f5d18SGreg Roach     *
54701f5d18SGreg Roach     * @return array<int|string,string>
55701f5d18SGreg Roach     */
56701f5d18SGreg Roach    public function values(): array
57701f5d18SGreg Roach    {
58701f5d18SGreg Roach        return [
59701f5d18SGreg Roach            ''          => '',
60701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
61701f5d18SGreg Roach            'BIC'       => I18N::translate('Born in the covenant'),
62701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
63701f5d18SGreg Roach            'CANCELED'  => I18N::translate('Sealing canceled (divorce)'),
64701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
65701f5d18SGreg Roach            'CHILD'     => I18N::translate('Died as a child: exempt'),
66701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
67701f5d18SGreg Roach            'COMPLETED' => I18N::translate('Completed; date unknown'),
68701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
69701f5d18SGreg Roach            'DNS'       => I18N::translate('Do not seal: unauthorized'),
70701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
71701f5d18SGreg Roach            'DNS/CAN'   => I18N::translate('Do not seal, previous sealing canceled'),
72701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
73701f5d18SGreg Roach            'EXCLUDED'  => I18N::translate('Excluded from this submission'),
74701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
75d64c51bcSGreg Roach            'INFANT'  => I18N::translate('Died less than 1 year old, sealing not required.'),
76701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
77701f5d18SGreg Roach            'PRE_1970'  => I18N::translate('Completed before 1970; date not available'),
78701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
79701f5d18SGreg Roach            'STILLBORN' => I18N::translate('Stillborn: exempt'),
80701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
81701f5d18SGreg Roach            'SUBMITTED' => I18N::translate('Submitted but not yet cleared'),
82701f5d18SGreg Roach            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
83701f5d18SGreg Roach            'UNCLEARED' => I18N::translate('Uncleared: insufficient data'),
84701f5d18SGreg Roach        ];
85701f5d18SGreg Roach    }
86701f5d18SGreg Roach}
87