xref: /webtrees/app/Elements/LdsOrdinanceStatus.php (revision cfb84ff6ed17b5cbf0afb82e6dc7c9f1f86e4432)
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
24use function strtoupper;
25
26/**
27 * g7:ord-STAT
28 */
29class LdsOrdinanceStatus extends AbstractElement
30{
31    private const CORRECTIONS = [
32        // PhpGedView misspells this tag.
33        'CANCELLED' => 'CANCELED',
34        // GEDCOM 5.5.1
35        'DNS/CAN'   => 'DNS_CAN',
36        'PRE-1970'  => 'PRE_1970',
37    ];
38
39    /**
40     * Convert a value to a canonical form.
41     *
42     * @param string $value
43     *
44     * @return string
45     */
46    public function canonical(string $value): string
47    {
48        return strtr(strtoupper(parent::canonical($value)), self::CORRECTIONS);
49    }
50
51    /**
52     * A list of controlled values for this element
53     *
54     * @return array<int|string,string>
55     */
56    public function values(): array
57    {
58        return [
59            ''          => '',
60            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
61            'BIC'       => I18N::translate('Born in the covenant'),
62            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
63            'CANCELED'  => I18N::translate('Sealing canceled (divorce)'),
64            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
65            'CHILD'     => I18N::translate('Died as a child: exempt'),
66            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
67            'COMPLETED' => I18N::translate('Completed; date unknown'),
68            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
69            'DNS'       => I18N::translate('Do not seal: unauthorized'),
70            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
71            'DNS/CAN'   => I18N::translate('Do not seal, previous sealing canceled'),
72            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
73            'EXCLUDED'  => I18N::translate('Excluded from this submission'),
74            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
75            'INFANT'  => I18N::translate('Died before less than 1 year old, sealing not required.'),
76            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
77            'PRE_1970'  => I18N::translate('Completed before 1970; date not available'),
78            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
79            'STILLBORN' => I18N::translate('Stillborn: exempt'),
80            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
81            'SUBMITTED' => I18N::translate('Submitted but not yet cleared'),
82            /* I18N: LDS sealing status; see https://en.wikipedia.org/wiki/Sealing_(Mormonism) */
83            'UNCLEARED' => I18N::translate('Uncleared: insufficient data'),
84        ];
85    }
86}
87