Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
AvailableCodes | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
getCodes | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\CLDR; |
4 | |
5 | /** |
6 | * List all language codes for which some data has been made available via CLDR. |
7 | * |
8 | * @license GPL-2.0-or-later |
9 | */ |
10 | class AvailableCodes { |
11 | |
12 | /** @var string[]|null */ |
13 | private static ?array $cache; |
14 | |
15 | /** |
16 | * Get the list of available files in CldrNames*.php, built by rebuild.php. |
17 | * |
18 | * @return string[] An array of locale codes in MediaWiki form. These can be passed to |
19 | * {@see LanguageNameUtils::getFileName} as in rebuild.php if calling code needs the data file |
20 | * names. |
21 | */ |
22 | public static function getCodes(): array { |
23 | if ( !isset( self::$cache ) ) { |
24 | $availableCodes = []; |
25 | require __DIR__ . '/../CldrAvailableCodes.php'; |
26 | self::$cache = $availableCodes; |
27 | } |
28 | return self::$cache; |
29 | } |
30 | |
31 | } |