Passed
Push — 2.1 ( ab9191...f7f27f )
by Greg
06:37
created

LanguageSerbianLatin::normalizeExceptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 13
rs 9.9
c 0
b 0
f 0
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\Module;
21
22
use Fisharebest\Localization\Locale\LocaleInterface;
23
use Fisharebest\Localization\Locale\LocaleSrLatn;
24
use Fisharebest\Webtrees\Encodings\UTF8;
25
26
/**
27
 * Class LanguageSerbianLatin.
28
 */
29
class LanguageSerbianLatin extends AbstractModule implements ModuleLanguageInterface
30
{
31
    use ModuleLanguageTrait;
32
33
    /**
34
     * Phone-book ordering of letters.
35
     *
36
     * @return array<int,string>
37
     */
38
    public function alphabet(): array
39
    {
40
        return [
41
            'A',
42
            'B',
43
            'C',
44
            UTF8::LATIN_CAPITAL_LETTER_C_WITH_CARON,
45
            UTF8::LATIN_CAPITAL_LETTER_C_WITH_ACUTE,
46
            'D',
47
            'D' . UTF8::LATIN_CAPITAL_LETTER_Z_WITH_CARON,
48
            UTF8::LATIN_CAPITAL_LETTER_D_WITH_STROKE,
49
            'E',
50
            'F',
51
            'G',
52
            'H',
53
            'I',
54
            'J',
55
            'K',
56
            'L',
57
            'LJ',
58
            'M',
59
            'N',
60
            'NJ',
61
            'O',
62
            'P',
63
            'Q',
64
            'R',
65
            'S',
66
            UTF8::LATIN_CAPITAL_LETTER_S_WITH_CARON,
67
            'T',
68
            'U',
69
            'V',
70
            'W',
71
            'X',
72
            'Y',
73
            'Z',
74
            UTF8::LATIN_CAPITAL_LETTER_Z_WITH_CARON,
75
        ];
76
    }
77
78
    /**
79
     * Should this module be enabled when it is first installed?
80
     *
81
     * @return bool
82
     */
83
    public function isEnabledByDefault(): bool
84
    {
85
        return false;
86
    }
87
88
    /**
89
     * @return LocaleInterface
90
     */
91
    public function locale(): LocaleInterface
92
    {
93
        return new LocaleSrLatn();
94
    }
95
96
    /**
97
     * Letters with diacritics that are considered distinct letters in this language.
98
     *
99
     * @return array<string,string>
100
     */
101
    protected function normalizeExceptions(): array
102
    {
103
        return [
104
            'C' . UTF8::COMBINING_CARON                => UTF8::LATIN_CAPITAL_LETTER_C_WITH_CARON,
105
            'C' . UTF8::COMBINING_CEDILLA              => UTF8::LATIN_CAPITAL_LETTER_C_WITH_ACUTE,
106
            'D' . UTF8::COMBINING_SHORT_STROKE_OVERLAY => UTF8::LATIN_CAPITAL_LETTER_D_WITH_STROKE,
107
            'S' . UTF8::COMBINING_CARON                => UTF8::LATIN_CAPITAL_LETTER_S_WITH_CARON,
108
            'Z' . UTF8::COMBINING_CARON                => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_CARON,
109
            'c' . UTF8::COMBINING_CARON                => UTF8::LATIN_SMALL_LETTER_C_WITH_CARON,
110
            'c' . UTF8::COMBINING_CEDILLA              => UTF8::LATIN_SMALL_LETTER_C_WITH_ACUTE,
111
            'd' . UTF8::COMBINING_SHORT_STROKE_OVERLAY => UTF8::LATIN_SMALL_LETTER_D_WITH_STROKE,
112
            's' . UTF8::COMBINING_CARON                => UTF8::LATIN_SMALL_LETTER_S_WITH_CARON,
113
            'z' . UTF8::COMBINING_CARON                => UTF8::LATIN_SMALL_LETTER_Z_WITH_CARON,
114
        ];
115
    }
116
}
117