Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
33.33% covered (danger)
33.33%
7 / 21
37.50% covered (danger)
37.50%
3 / 8
CRAP
0.00% covered (danger)
0.00%
0 / 1
GanConverter
33.33% covered (danger)
33.33%
7 / 21
37.50% covered (danger)
37.50%
3 / 8
26.96
0.00% covered (danger)
0.00%
0 / 1
 getMainCode
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getLanguageVariants
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getVariantsFallbacks
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
 getAdditionalManualLevel
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDescVarSeparator
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getVariantNames
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
 loadDefaultTables
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 convertCategoryKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 */
20
21/**
22 * Gan Chinese specific code.
23 *
24 * @ingroup Languages
25 */
26class GanConverter extends LanguageConverter {
27
28    public function getMainCode(): string {
29        return 'gan';
30    }
31
32    public function getLanguageVariants(): array {
33        return [ 'gan', 'gan-hans', 'gan-hant' ];
34    }
35
36    public function getVariantsFallbacks(): array {
37        return [
38            'gan' => [ 'gan-hans', 'gan-hant' ],
39            'gan-hans' => [ 'gan' ],
40            'gan-hant' => [ 'gan' ],
41        ];
42    }
43
44    /**
45     * Get manual level limit for supported variants.
46     * @since 1.36
47     *
48     * @return array
49     */
50    protected function getAdditionalManualLevel(): array {
51        return [ 'gan' => 'disable' ];
52    }
53
54    public function getDescVarSeparator(): string {
55        return '; ';
56    }
57
58    public function getVariantNames(): array {
59        $names = [
60            'gan' => '原文',
61            'gan-hans' => '简体',
62            'gan-hant' => '繁體',
63        ];
64        return array_merge( parent::getVariantNames(), $names );
65    }
66
67    protected function loadDefaultTables(): array {
68        return [
69            'gan-hans' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::ZH_TO_HANS ),
70            'gan-hant' => new ReplacementArray( MediaWiki\Languages\Data\ZhConversion::ZH_TO_HANT ),
71            'gan' => new ReplacementArray
72        ];
73    }
74
75    public function convertCategoryKey( $key ) {
76        return $this->autoConvert( $key, 'gan' );
77    }
78}