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

LanguageKazhak   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 42
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A normalizeExceptions() 0 7 1
A locale() 0 3 1
A alphabet() 0 36 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\Module;
21
22
use Fisharebest\Localization\Locale\LocaleInterface;
23
use Fisharebest\Localization\Locale\LocaleKk;
24
use Fisharebest\Webtrees\Encodings\UTF8;
25
26
/**
27
 * Class LanguageKazhak.
28
 */
29
class LanguageKazhak 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
            UTF8::CYRILLIC_CAPITAL_LETTER_A,
42
            UTF8::CYRILLIC_CAPITAL_LETTER_BE,
43
            UTF8::CYRILLIC_CAPITAL_LETTER_VE,
44
            UTF8::CYRILLIC_CAPITAL_LETTER_GHE,
45
            UTF8::CYRILLIC_CAPITAL_LETTER_DE,
46
            UTF8::CYRILLIC_CAPITAL_LETTER_IE,
47
            UTF8::CYRILLIC_CAPITAL_LETTER_IO,
48
            UTF8::CYRILLIC_CAPITAL_LETTER_ZHE,
49
            UTF8::CYRILLIC_CAPITAL_LETTER_ZE,
50
            UTF8::CYRILLIC_CAPITAL_LETTER_I,
51
            UTF8::CYRILLIC_CAPITAL_LETTER_SHORT_I,
52
            UTF8::CYRILLIC_CAPITAL_LETTER_KA,
53
            UTF8::CYRILLIC_CAPITAL_LETTER_EL,
54
            UTF8::CYRILLIC_CAPITAL_LETTER_EM,
55
            UTF8::CYRILLIC_CAPITAL_LETTER_EN,
56
            UTF8::CYRILLIC_CAPITAL_LETTER_O,
57
            UTF8::CYRILLIC_CAPITAL_LETTER_PE,
58
            UTF8::CYRILLIC_CAPITAL_LETTER_ER,
59
            UTF8::CYRILLIC_CAPITAL_LETTER_ES,
60
            UTF8::CYRILLIC_CAPITAL_LETTER_TE,
61
            UTF8::CYRILLIC_CAPITAL_LETTER_U,
62
            UTF8::CYRILLIC_CAPITAL_LETTER_EF,
63
            UTF8::CYRILLIC_CAPITAL_LETTER_HA,
64
            UTF8::CYRILLIC_CAPITAL_LETTER_TSE,
65
            UTF8::CYRILLIC_CAPITAL_LETTER_CHE,
66
            UTF8::CYRILLIC_CAPITAL_LETTER_SHA,
67
            UTF8::CYRILLIC_CAPITAL_LETTER_SHCHA,
68
            UTF8::CYRILLIC_CAPITAL_LETTER_HARD_SIGN,
69
            UTF8::CYRILLIC_CAPITAL_LETTER_YERU,
70
            UTF8::CYRILLIC_CAPITAL_LETTER_SOFT_SIGN,
71
            UTF8::CYRILLIC_CAPITAL_LETTER_E,
72
            UTF8::CYRILLIC_CAPITAL_LETTER_YU,
73
            UTF8::CYRILLIC_CAPITAL_LETTER_YA,
74
        ];
75
    }
76
77
    /**
78
     * @return LocaleInterface
79
     */
80
    public function locale(): LocaleInterface
81
    {
82
        return new LocaleKk();
83
    }
84
85
86
    /**
87
     * Letters with diacritics that are considered distinct letters in this language.
88
     *
89
     * @return array<string,string>
90
     */
91
    protected function normalizeExceptions(): array
92
    {
93
        return [
94
            UTF8::CYRILLIC_CAPITAL_LETTER_IE . UTF8::COMBINING_DIAERESIS => UTF8::CYRILLIC_CAPITAL_LETTER_IO,
95
            UTF8::CYRILLIC_SMALL_LETTER_IE . UTF8::COMBINING_DIAERESIS   => UTF8::CYRILLIC_SMALL_LETTER_IO,
96
            UTF8::CYRILLIC_CAPITAL_LETTER_I . UTF8::COMBINING_BREVE      => UTF8::CYRILLIC_CAPITAL_LETTER_SHORT_I,
97
            UTF8::CYRILLIC_SMALL_LETTER_I . UTF8::COMBINING_BREVE        => UTF8::CYRILLIC_SMALL_LETTER_SHORT_I,
98
        ];
99
    }
100
}
101