Passed
Push — main ( 5af3ec...9d9399 )
by Greg
08:36
created

CountryService::mapTwoLetterToName()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
/**
4
 * webtrees: online genealogy
5
 * Copyright (C) 2023 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\Statistics\Service;
21
22
use Fisharebest\Webtrees\I18N;
0 ignored issues
show
Bug introduced by
The type Fisharebest\Webtrees\I18N was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
24
/**
25
 * This class is used by the fancy-tree-view and fancy-research-links modules.
26
 * It will be removed in webtrees 2.3.
27
 *
28
 * @deprecated
29
 */
30
class CountryService
31
{
32
    /**
33
     * Country codes and names
34
     *
35
     * @return array<string>
36
     */
37
    public function getAllCountries(): array
38
    {
39
        return [
40
            /* I18N: Name of a country or state */
41
            '???' => I18N::translate('Unknown'),
42
            /* I18N: Name of a country or state */
43
            'ABW' => I18N::translate('Aruba'),
44
            /* I18N: Name of a country or state */
45
            'AFG' => I18N::translate('Afghanistan'),
46
            /* I18N: Name of a country or state */
47
            'AGO' => I18N::translate('Angola'),
48
            /* I18N: Name of a country or state */
49
            'AIA' => I18N::translate('Anguilla'),
50
            /* I18N: Name of a country or state */
51
            'ALA' => I18N::translate('Åland Islands'),
52
            /* I18N: Name of a country or state */
53
            'ALB' => I18N::translate('Albania'),
54
            /* I18N: Name of a country or state */
55
            'AND' => I18N::translate('Andorra'),
56
            /* I18N: Name of a country or state */
57
            'ARE' => I18N::translate('United Arab Emirates'),
58
            /* I18N: Name of a country or state */
59
            'ARG' => I18N::translate('Argentina'),
60
            /* I18N: Name of a country or state */
61
            'ARM' => I18N::translate('Armenia'),
62
            /* I18N: Name of a country or state */
63
            'ASM' => I18N::translate('American Samoa'),
64
            /* I18N: Name of a country or state */
65
            'ATA' => I18N::translate('Antarctica'),
66
            /* I18N: Name of a country or state */
67
            'ATF' => I18N::translate('French Southern Territories'),
68
            /* I18N: Name of a country or state */
69
            'ATG' => I18N::translate('Antigua and Barbuda'),
70
            /* I18N: Name of a country or state */
71
            'AUS' => I18N::translate('Australia'),
72
            /* I18N: Name of a country or state */
73
            'AUT' => I18N::translate('Austria'),
74
            /* I18N: Name of a country or state */
75
            'AZE' => I18N::translate('Azerbaijan'),
76
            /* I18N: Name of a country or state */
77
            'AZR' => I18N::translate('Azores'),
78
            /* I18N: Name of a country or state */
79
            'BDI' => I18N::translate('Burundi'),
80
            /* I18N: Name of a country or state */
81
            'BEL' => I18N::translate('Belgium'),
82
            /* I18N: Name of a country or state */
83
            'BEN' => I18N::translate('Benin'),
84
            // BES => Bonaire, Sint Eustatius and Saba
85
            /* I18N: Name of a country or state */
86
            'BFA' => I18N::translate('Burkina Faso'),
87
            /* I18N: Name of a country or state */
88
            'BGD' => I18N::translate('Bangladesh'),
89
            /* I18N: Name of a country or state */
90
            'BGR' => I18N::translate('Bulgaria'),
91
            /* I18N: Name of a country or state */
92
            'BHR' => I18N::translate('Bahrain'),
93
            /* I18N: Name of a country or state */
94
            'BHS' => I18N::translate('Bahamas'),
95
            /* I18N: Name of a country or state */
96
            'BIH' => I18N::translate('Bosnia and Herzegovina'),
97
            // BLM => Saint Barthélemy
98
            'BLM' => I18N::translate('Saint Barthélemy'),
99
            /* I18N: Name of a country or state */
100
            'BLR' => I18N::translate('Belarus'),
101
            /* I18N: Name of a country or state */
102
            'BLZ' => I18N::translate('Belize'),
103
            /* I18N: Name of a country or state */
104
            'BMU' => I18N::translate('Bermuda'),
105
            /* I18N: Name of a country or state */
106
            'BOL' => I18N::translate('Bolivia'),
107
            /* I18N: Name of a country or state */
108
            'BRA' => I18N::translate('Brazil'),
109
            /* I18N: Name of a country or state */
110
            'BRB' => I18N::translate('Barbados'),
111
            /* I18N: Name of a country or state */
112
            'BRN' => I18N::translate('Brunei Darussalam'),
113
            /* I18N: Name of a country or state */
114
            'BTN' => I18N::translate('Bhutan'),
115
            /* I18N: Name of a country or state */
116
            'BVT' => I18N::translate('Bouvet Island'),
117
            /* I18N: Name of a country or state */
118
            'BWA' => I18N::translate('Botswana'),
119
            /* I18N: Name of a country or state */
120
            'CAF' => I18N::translate('Central African Republic'),
121
            /* I18N: Name of a country or state */
122
            'CAN' => I18N::translate('Canada'),
123
            /* I18N: Name of a country or state */
124
            'CCK' => I18N::translate('Cocos (Keeling) Islands'),
125
            /* I18N: Name of a country or state */
126
            'CHE' => I18N::translate('Switzerland'),
127
            /* I18N: Name of a country or state */
128
            'CHL' => I18N::translate('Chile'),
129
            /* I18N: Name of a country or state */
130
            'CHN' => I18N::translate('China'),
131
            /* I18N: Name of a country or state */
132
            'CIV' => I18N::translate('Côte d’Ivoire'),
133
            /* I18N: Name of a country or state */
134
            'CMR' => I18N::translate('Cameroon'),
135
            /* I18N: Name of a country or state */
136
            'COD' => I18N::translate('Democratic Republic of the Congo'),
137
            /* I18N: Name of a country or state */
138
            'COG' => I18N::translate('Republic of the Congo'),
139
            /* I18N: Name of a country or state */
140
            'COK' => I18N::translate('Cook Islands'),
141
            /* I18N: Name of a country or state */
142
            'COL' => I18N::translate('Colombia'),
143
            /* I18N: Name of a country or state */
144
            'COM' => I18N::translate('Comoros'),
145
            /* I18N: Name of a country or state */
146
            'CPV' => I18N::translate('Cape Verde'),
147
            /* I18N: Name of a country or state */
148
            'CRI' => I18N::translate('Costa Rica'),
149
            /* I18N: Name of a country or state */
150
            'CUB' => I18N::translate('Cuba'),
151
            /* I18N: Name of a country or state */
152
            'CUW' => I18N::translate('Curaçao'),
153
            /* I18N: Name of a country or state */
154
            'CXR' => I18N::translate('Christmas Island'),
155
            /* I18N: Name of a country or state */
156
            'CYM' => I18N::translate('Cayman Islands'),
157
            /* I18N: Name of a country or state */
158
            'CYP' => I18N::translate('Cyprus'),
159
            /* I18N: Name of a country or state */
160
            'CZE' => I18N::translate('Czech Republic'),
161
            /* I18N: Name of a country or state */
162
            'DEU' => I18N::translate('Germany'),
163
            /* I18N: Name of a country or state */
164
            'DJI' => I18N::translate('Djibouti'),
165
            /* I18N: Name of a country or state */
166
            'DMA' => I18N::translate('Dominica'),
167
            /* I18N: Name of a country or state */
168
            'DNK' => I18N::translate('Denmark'),
169
            /* I18N: Name of a country or state */
170
            'DOM' => I18N::translate('Dominican Republic'),
171
            /* I18N: Name of a country or state */
172
            'DZA' => I18N::translate('Algeria'),
173
            /* I18N: Name of a country or state */
174
            'ECU' => I18N::translate('Ecuador'),
175
            /* I18N: Name of a country or state */
176
            'EGY' => I18N::translate('Egypt'),
177
            /* I18N: Name of a country or state */
178
            'ENG' => I18N::translate('England'),
179
            /* I18N: Name of a country or state */
180
            'ERI' => I18N::translate('Eritrea'),
181
            /* I18N: Name of a country or state */
182
            'ESH' => I18N::translate('Western Sahara'),
183
            /* I18N: Name of a country or state */
184
            'ESP' => I18N::translate('Spain'),
185
            /* I18N: Name of a country or state */
186
            'EST' => I18N::translate('Estonia'),
187
            /* I18N: Name of a country or state */
188
            'ETH' => I18N::translate('Ethiopia'),
189
            /* I18N: Name of a country or state */
190
            'FIN' => I18N::translate('Finland'),
191
            /* I18N: Name of a country or state */
192
            'FJI' => I18N::translate('Fiji'),
193
            /* I18N: Name of a country or state */
194
            'FLD' => I18N::translate('Flanders'),
195
            /* I18N: Name of a country or state */
196
            'FLK' => I18N::translate('Falkland Islands'),
197
            /* I18N: Name of a country or state */
198
            'FRA' => I18N::translate('France'),
199
            /* I18N: Name of a country or state */
200
            'FRO' => I18N::translate('Faroe Islands'),
201
            /* I18N: Name of a country or state */
202
            'FSM' => I18N::translate('Micronesia'),
203
            /* I18N: Name of a country or state */
204
            'GAB' => I18N::translate('Gabon'),
205
            /* I18N: Name of a country or state */
206
            'GBR' => I18N::translate('United Kingdom'),
207
            /* I18N: Name of a country or state */
208
            'GEO' => I18N::translate('Georgia'),
209
            /* I18N: Name of a country or state */
210
            'GGY' => I18N::translate('Guernsey'),
211
            /* I18N: Name of a country or state */
212
            'GHA' => I18N::translate('Ghana'),
213
            /* I18N: Name of a country or state */
214
            'GIB' => I18N::translate('Gibraltar'),
215
            /* I18N: Name of a country or state */
216
            'GIN' => I18N::translate('Guinea'),
217
            /* I18N: Name of a country or state */
218
            'GLP' => I18N::translate('Guadeloupe'),
219
            /* I18N: Name of a country or state */
220
            'GMB' => I18N::translate('Gambia'),
221
            /* I18N: Name of a country or state */
222
            'GNB' => I18N::translate('Guinea-Bissau'),
223
            /* I18N: Name of a country or state */
224
            'GNQ' => I18N::translate('Equatorial Guinea'),
225
            /* I18N: Name of a country or state */
226
            'GRC' => I18N::translate('Greece'),
227
            /* I18N: Name of a country or state */
228
            'GRD' => I18N::translate('Grenada'),
229
            /* I18N: Name of a country or state */
230
            'GRL' => I18N::translate('Greenland'),
231
            /* I18N: Name of a country or state */
232
            'GTM' => I18N::translate('Guatemala'),
233
            /* I18N: Name of a country or state */
234
            'GUF' => I18N::translate('French Guiana'),
235
            /* I18N: Name of a country or state */
236
            'GUM' => I18N::translate('Guam'),
237
            /* I18N: Name of a country or state */
238
            'GUY' => I18N::translate('Guyana'),
239
            /* I18N: Name of a country or state */
240
            'HKG' => I18N::translate('Hong Kong'),
241
            /* I18N: Name of a country or state */
242
            'HMD' => I18N::translate('Heard Island and McDonald Islands'),
243
            /* I18N: Name of a country or state */
244
            'HND' => I18N::translate('Honduras'),
245
            /* I18N: Name of a country or state */
246
            'HRV' => I18N::translate('Croatia'),
247
            /* I18N: Name of a country or state */
248
            'HTI' => I18N::translate('Haiti'),
249
            /* I18N: Name of a country or state */
250
            'HUN' => I18N::translate('Hungary'),
251
            /* I18N: Name of a country or state */
252
            'IDN' => I18N::translate('Indonesia'),
253
            /* I18N: Name of a country or state */
254
            'IND' => I18N::translate('India'),
255
            /* I18N: Name of a country or state */
256
            'IOM' => I18N::translate('Isle of Man'),
257
            /* I18N: Name of a country or state */
258
            'IOT' => I18N::translate('British Indian Ocean Territory'),
259
            /* I18N: Name of a country or state */
260
            'IRL' => I18N::translate('Ireland'),
261
            /* I18N: Name of a country or state */
262
            'IRN' => I18N::translate('Iran'),
263
            /* I18N: Name of a country or state */
264
            'IRQ' => I18N::translate('Iraq'),
265
            /* I18N: Name of a country or state */
266
            'ISL' => I18N::translate('Iceland'),
267
            /* I18N: Name of a country or state */
268
            'ISR' => I18N::translate('Israel'),
269
            /* I18N: Name of a country or state */
270
            'ITA' => I18N::translate('Italy'),
271
            /* I18N: Name of a country or state */
272
            'JAM' => I18N::translate('Jamaica'),
273
            //'JEY' => Jersey
274
            /* I18N: Name of a country or state */
275
            'JOR' => I18N::translate('Jordan'),
276
            /* I18N: Name of a country or state */
277
            'JPN' => I18N::translate('Japan'),
278
            /* I18N: Name of a country or state */
279
            'KAZ' => I18N::translate('Kazakhstan'),
280
            /* I18N: Name of a country or state */
281
            'KEN' => I18N::translate('Kenya'),
282
            /* I18N: Name of a country or state */
283
            'KGZ' => I18N::translate('Kyrgyzstan'),
284
            /* I18N: Name of a country or state */
285
            'KHM' => I18N::translate('Cambodia'),
286
            /* I18N: Name of a country or state */
287
            'KIR' => I18N::translate('Kiribati'),
288
            /* I18N: Name of a country or state */
289
            'KNA' => I18N::translate('Saint Kitts and Nevis'),
290
            /* I18N: Name of a country or state */
291
            'KOR' => I18N::translate('Korea'),
292
            /* I18N: Name of a country or state */
293
            'KWT' => I18N::translate('Kuwait'),
294
            /* I18N: Name of a country or state */
295
            'LAO' => I18N::translate('Laos'),
296
            /* I18N: Name of a country or state */
297
            'LBN' => I18N::translate('Lebanon'),
298
            /* I18N: Name of a country or state */
299
            'LBR' => I18N::translate('Liberia'),
300
            /* I18N: Name of a country or state */
301
            'LBY' => I18N::translate('Libya'),
302
            /* I18N: Name of a country or state */
303
            'LCA' => I18N::translate('Saint Lucia'),
304
            /* I18N: Name of a country or state */
305
            'LIE' => I18N::translate('Liechtenstein'),
306
            /* I18N: Name of a country or state */
307
            'LKA' => I18N::translate('Sri Lanka'),
308
            /* I18N: Name of a country or state */
309
            'LSO' => I18N::translate('Lesotho'),
310
            /* I18N: Name of a country or state */
311
            'LTU' => I18N::translate('Lithuania'),
312
            /* I18N: Name of a country or state */
313
            'LUX' => I18N::translate('Luxembourg'),
314
            /* I18N: Name of a country or state */
315
            'LVA' => I18N::translate('Latvia'),
316
            /* I18N: Name of a country or state */
317
            'MAC' => I18N::translate('Macau'),
318
            // MAF => Saint Martin
319
            /* I18N: Name of a country or state */
320
            'MAR' => I18N::translate('Morocco'),
321
            /* I18N: Name of a country or state */
322
            'MCO' => I18N::translate('Monaco'),
323
            /* I18N: Name of a country or state */
324
            'MDA' => I18N::translate('Moldova'),
325
            /* I18N: Name of a country or state */
326
            'MDG' => I18N::translate('Madagascar'),
327
            /* I18N: Name of a country or state */
328
            'MDV' => I18N::translate('Maldives'),
329
            /* I18N: Name of a country or state */
330
            'MEX' => I18N::translate('Mexico'),
331
            /* I18N: Name of a country or state */
332
            'MHL' => I18N::translate('Marshall Islands'),
333
            /* I18N: Name of a country or state */
334
            'MKD' => I18N::translate('Macedonia'),
335
            /* I18N: Name of a country or state */
336
            'MLI' => I18N::translate('Mali'),
337
            /* I18N: Name of a country or state */
338
            'MLT' => I18N::translate('Malta'),
339
            /* I18N: Name of a country or state */
340
            'MMR' => I18N::translate('Myanmar'),
341
            /* I18N: Name of a country or state */
342
            'MNG' => I18N::translate('Mongolia'),
343
            /* I18N: Name of a country or state */
344
            'MNP' => I18N::translate('Northern Mariana Islands'),
345
            /* I18N: Name of a country or state */
346
            'MNT' => I18N::translate('Montenegro'),
347
            /* I18N: Name of a country or state */
348
            'MOZ' => I18N::translate('Mozambique'),
349
            /* I18N: Name of a country or state */
350
            'MRT' => I18N::translate('Mauritania'),
351
            /* I18N: Name of a country or state */
352
            'MSR' => I18N::translate('Montserrat'),
353
            /* I18N: Name of a country or state */
354
            'MTQ' => I18N::translate('Martinique'),
355
            /* I18N: Name of a country or state */
356
            'MUS' => I18N::translate('Mauritius'),
357
            /* I18N: Name of a country or state */
358
            'MWI' => I18N::translate('Malawi'),
359
            /* I18N: Name of a country or state */
360
            'MYS' => I18N::translate('Malaysia'),
361
            /* I18N: Name of a country or state */
362
            'MYT' => I18N::translate('Mayotte'),
363
            /* I18N: Name of a country or state */
364
            'NAM' => I18N::translate('Namibia'),
365
            /* I18N: Name of a country or state */
366
            'NCL' => I18N::translate('New Caledonia'),
367
            /* I18N: Name of a country or state */
368
            'NER' => I18N::translate('Niger'),
369
            /* I18N: Name of a country or state */
370
            'NFK' => I18N::translate('Norfolk Island'),
371
            /* I18N: Name of a country or state */
372
            'NGA' => I18N::translate('Nigeria'),
373
            /* I18N: Name of a country or state */
374
            'NIC' => I18N::translate('Nicaragua'),
375
            /* I18N: Name of a country or state */
376
            'NIR' => I18N::translate('Northern Ireland'),
377
            /* I18N: Name of a country or state */
378
            'NIU' => I18N::translate('Niue'),
379
            /* I18N: Name of a country or state */
380
            'NLD' => I18N::translate('Netherlands'),
381
            /* I18N: Name of a country or state */
382
            'NOR' => I18N::translate('Norway'),
383
            /* I18N: Name of a country or state */
384
            'NPL' => I18N::translate('Nepal'),
385
            /* I18N: Name of a country or state */
386
            'NRU' => I18N::translate('Nauru'),
387
            /* I18N: Name of a country or state */
388
            'NZL' => I18N::translate('New Zealand'),
389
            /* I18N: Name of a country or state */
390
            'OMN' => I18N::translate('Oman'),
391
            /* I18N: Name of a country or state */
392
            'PAK' => I18N::translate('Pakistan'),
393
            /* I18N: Name of a country or state */
394
            'PAN' => I18N::translate('Panama'),
395
            /* I18N: Name of a country or state */
396
            'PCN' => I18N::translate('Pitcairn'),
397
            /* I18N: Name of a country or state */
398
            'PER' => I18N::translate('Peru'),
399
            /* I18N: Name of a country or state */
400
            'PHL' => I18N::translate('Philippines'),
401
            /* I18N: Name of a country or state */
402
            'PLW' => I18N::translate('Palau'),
403
            /* I18N: Name of a country or state */
404
            'PNG' => I18N::translate('Papua New Guinea'),
405
            /* I18N: Name of a country or state */
406
            'POL' => I18N::translate('Poland'),
407
            /* I18N: Name of a country or state */
408
            'PRI' => I18N::translate('Puerto Rico'),
409
            /* I18N: Name of a country or state */
410
            'PRK' => I18N::translate('North Korea'),
411
            /* I18N: Name of a country or state */
412
            'PRT' => I18N::translate('Portugal'),
413
            /* I18N: Name of a country or state */
414
            'PRY' => I18N::translate('Paraguay'),
415
            /* I18N: Name of a country or state */
416
            'PSE' => I18N::translate('Occupied Palestinian Territory'),
417
            /* I18N: Name of a country or state */
418
            'PYF' => I18N::translate('French Polynesia'),
419
            /* I18N: Name of a country or state */
420
            'QAT' => I18N::translate('Qatar'),
421
            /* I18N: Name of a country or state */
422
            'REU' => I18N::translate('Réunion'),
423
            /* I18N: Name of a country or state */
424
            'ROM' => I18N::translate('Romania'),
425
            /* I18N: Name of a country or state */
426
            'RUS' => I18N::translate('Russia'),
427
            /* I18N: Name of a country or state */
428
            'RWA' => I18N::translate('Rwanda'),
429
            /* I18N: Name of a country or state */
430
            'SAU' => I18N::translate('Saudi Arabia'),
431
            /* I18N: Name of a country or state */
432
            'SCT' => I18N::translate('Scotland'),
433
            /* I18N: Name of a country or state */
434
            'SDN' => I18N::translate('Sudan'),
435
            /* I18N: Name of a country or state */
436
            'SEA' => I18N::translate('At sea'),
437
            /* I18N: Name of a country or state */
438
            'SEN' => I18N::translate('Senegal'),
439
            /* I18N: Name of a country or state */
440
            'SER' => I18N::translate('Serbia'),
441
            /* I18N: Name of a country or state */
442
            'SGP' => I18N::translate('Singapore'),
443
            /* I18N: Name of a country or state */
444
            'SGS' => I18N::translate('South Georgia and the South Sandwich Islands'),
445
            /* I18N: Name of a country or state */
446
            'SHN' => I18N::translate('Saint Helena'),
447
            /* I18N: Name of a country or state */
448
            'SJM' => I18N::translate('Svalbard and Jan Mayen'),
449
            /* I18N: Name of a country or state */
450
            'SLB' => I18N::translate('Solomon Islands'),
451
            /* I18N: Name of a country or state */
452
            'SLE' => I18N::translate('Sierra Leone'),
453
            /* I18N: Name of a country or state */
454
            'SLV' => I18N::translate('El Salvador'),
455
            /* I18N: Name of a country or state */
456
            'SMR' => I18N::translate('San Marino'),
457
            /* I18N: Name of a country or state */
458
            'SOM' => I18N::translate('Somalia'),
459
            /* I18N: Name of a country or state */
460
            'SPM' => I18N::translate('Saint Pierre and Miquelon'),
461
            /* I18N: Name of a country or state */
462
            'SSD' => I18N::translate('South Sudan'),
463
            /* I18N: Name of a country or state */
464
            'STP' => I18N::translate('Sao Tome and Principe'),
465
            /* I18N: Name of a country or state */
466
            'SUR' => I18N::translate('Suriname'),
467
            /* I18N: Name of a country or state */
468
            'SVK' => I18N::translate('Slovakia'),
469
            /* I18N: Name of a country or state */
470
            'SVN' => I18N::translate('Slovenia'),
471
            /* I18N: Name of a country or state */
472
            'SWE' => I18N::translate('Sweden'),
473
            /* I18N: Name of a country or state */
474
            'SWZ' => I18N::translate('Swaziland'),
475
            // SXM => Sint Maarten
476
            /* I18N: Name of a country or state */
477
            'SYC' => I18N::translate('Seychelles'),
478
            /* I18N: Name of a country or state */
479
            'SYR' => I18N::translate('Syria'),
480
            /* I18N: Name of a country or state */
481
            'TCA' => I18N::translate('Turks and Caicos Islands'),
482
            /* I18N: Name of a country or state */
483
            'TCD' => I18N::translate('Chad'),
484
            /* I18N: Name of a country or state */
485
            'TGO' => I18N::translate('Togo'),
486
            /* I18N: Name of a country or state */
487
            'THA' => I18N::translate('Thailand'),
488
            /* I18N: Name of a country or state */
489
            'TJK' => I18N::translate('Tajikistan'),
490
            /* I18N: Name of a country or state */
491
            'TKL' => I18N::translate('Tokelau'),
492
            /* I18N: Name of a country or state */
493
            'TKM' => I18N::translate('Turkmenistan'),
494
            /* I18N: Name of a country or state */
495
            'TLS' => I18N::translate('Timor-Leste'),
496
            /* I18N: Name of a country or state */
497
            'TON' => I18N::translate('Tonga'),
498
            /* I18N: Name of a country or state */
499
            'TTO' => I18N::translate('Trinidad and Tobago'),
500
            /* I18N: Name of a country or state */
501
            'TUN' => I18N::translate('Tunisia'),
502
            /* I18N: Name of a country or state */
503
            'TUR' => I18N::translate('Turkey'),
504
            /* I18N: Name of a country or state */
505
            'TUV' => I18N::translate('Tuvalu'),
506
            /* I18N: Name of a country or state */
507
            'TWN' => I18N::translate('Taiwan'),
508
            /* I18N: Name of a country or state */
509
            'TZA' => I18N::translate('Tanzania'),
510
            /* I18N: Name of a country or state */
511
            'UGA' => I18N::translate('Uganda'),
512
            /* I18N: Name of a country or state */
513
            'UKR' => I18N::translate('Ukraine'),
514
            /* I18N: Name of a country or state */
515
            'UMI' => I18N::translate('US Minor Outlying Islands'),
516
            /* I18N: Name of a country or state */
517
            'URY' => I18N::translate('Uruguay'),
518
            /* I18N: Name of a country or state */
519
            'USA' => I18N::translate('United States'),
520
            /* I18N: Name of a country or state */
521
            'UZB' => I18N::translate('Uzbekistan'),
522
            /* I18N: Name of a country or state */
523
            'VAT' => I18N::translate('Vatican City'),
524
            /* I18N: Name of a country or state */
525
            'VCT' => I18N::translate('Saint Vincent and the Grenadines'),
526
            /* I18N: Name of a country or state */
527
            'VEN' => I18N::translate('Venezuela'),
528
            /* I18N: Name of a country or state */
529
            'VGB' => I18N::translate('British Virgin Islands'),
530
            /* I18N: Name of a country or state */
531
            'VIR' => I18N::translate('US Virgin Islands'),
532
            /* I18N: Name of a country or state */
533
            'VNM' => I18N::translate('Vietnam'),
534
            /* I18N: Name of a country or state */
535
            'VUT' => I18N::translate('Vanuatu'),
536
            /* I18N: Name of a country or state */
537
            'WLF' => I18N::translate('Wallis and Futuna'),
538
            /* I18N: Name of a country or state */
539
            'WLS' => I18N::translate('Wales'),
540
            /* I18N: Name of a country or state */
541
            'WSM' => I18N::translate('Samoa'),
542
            /* I18N: Name of a country or state */
543
            'YEM' => I18N::translate('Yemen'),
544
            /* I18N: Name of a country or state */
545
            'ZAF' => I18N::translate('South Africa'),
546
            /* I18N: Name of a country or state */
547
            'ZMB' => I18N::translate('Zambia'),
548
            /* I18N: Name of a country or state */
549
            'ZWE' => I18N::translate('Zimbabwe'),
550
        ];
551
    }
552
553
    /**
554
     * ISO3166 3 letter codes, with their 2 letter equivalent.
555
     * NOTE: this is not 1:1. ENG/SCO/WAL/NIR => GB
556
     * NOTE: this also includes chapman codes and others. Should it?
557
     *
558
     * @return array<string>
559
     */
560
    public function iso3166(): array
561
    {
562
        return [
563
            'GBR' => 'GB', // Must come before ENG, NIR, SCT and WLS
564
            'ABW' => 'AW',
565
            'AFG' => 'AF',
566
            'AGO' => 'AO',
567
            'AIA' => 'AI',
568
            'ALA' => 'AX',
569
            'ALB' => 'AL',
570
            'AND' => 'AD',
571
            'ARE' => 'AE',
572
            'ARG' => 'AR',
573
            'ARM' => 'AM',
574
            'ASM' => 'AS',
575
            'ATA' => 'AQ',
576
            'ATF' => 'TF',
577
            'ATG' => 'AG',
578
            'AUS' => 'AU',
579
            'AUT' => 'AT',
580
            'AZE' => 'AZ',
581
            'BDI' => 'BI',
582
            'BEL' => 'BE',
583
            'BEN' => 'BJ',
584
            'BFA' => 'BF',
585
            'BGD' => 'BD',
586
            'BGR' => 'BG',
587
            'BHR' => 'BH',
588
            'BHS' => 'BS',
589
            'BIH' => 'BA',
590
            'BLR' => 'BY',
591
            'BLZ' => 'BZ',
592
            'BMU' => 'BM',
593
            'BOL' => 'BO',
594
            'BRA' => 'BR',
595
            'BRB' => 'BB',
596
            'BRN' => 'BN',
597
            'BTN' => 'BT',
598
            'BVT' => 'BV',
599
            'BWA' => 'BW',
600
            'CAF' => 'CF',
601
            'CAN' => 'CA',
602
            'CCK' => 'CC',
603
            'CHE' => 'CH',
604
            'CHL' => 'CL',
605
            'CHN' => 'CN',
606
            'CIV' => 'CI',
607
            'CMR' => 'CM',
608
            'COD' => 'CD',
609
            'COG' => 'CG',
610
            'COK' => 'CK',
611
            'COL' => 'CO',
612
            'COM' => 'KM',
613
            'CPV' => 'CV',
614
            'CRI' => 'CR',
615
            'CUB' => 'CU',
616
            'CXR' => 'CX',
617
            'CYM' => 'KY',
618
            'CYP' => 'CY',
619
            'CZE' => 'CZ',
620
            'DEU' => 'DE',
621
            'DJI' => 'DJ',
622
            'DMA' => 'DM',
623
            'DNK' => 'DK',
624
            'DOM' => 'DO',
625
            'DZA' => 'DZ',
626
            'ECU' => 'EC',
627
            'EGY' => 'EG',
628
            'ENG' => 'GB',
629
            'ERI' => 'ER',
630
            'ESH' => 'EH',
631
            'ESP' => 'ES',
632
            'EST' => 'EE',
633
            'ETH' => 'ET',
634
            'FIN' => 'FI',
635
            'FJI' => 'FJ',
636
            'FLK' => 'FK',
637
            'FRA' => 'FR',
638
            'FRO' => 'FO',
639
            'FSM' => 'FM',
640
            'GAB' => 'GA',
641
            'GEO' => 'GE',
642
            'GHA' => 'GH',
643
            'GIB' => 'GI',
644
            'GIN' => 'GN',
645
            'GLP' => 'GP',
646
            'GMB' => 'GM',
647
            'GNB' => 'GW',
648
            'GNQ' => 'GQ',
649
            'GRC' => 'GR',
650
            'GRD' => 'GD',
651
            'GRL' => 'GL',
652
            'GTM' => 'GT',
653
            'GUF' => 'GF',
654
            'GUM' => 'GU',
655
            'GUY' => 'GY',
656
            'HKG' => 'HK',
657
            'HMD' => 'HM',
658
            'HND' => 'HN',
659
            'HRV' => 'HR',
660
            'HTI' => 'HT',
661
            'HUN' => 'HU',
662
            'IDN' => 'ID',
663
            'IND' => 'IN',
664
            'IOT' => 'IO',
665
            'IRL' => 'IE',
666
            'IRN' => 'IR',
667
            'IRQ' => 'IQ',
668
            'ISL' => 'IS',
669
            'ISR' => 'IL',
670
            'ITA' => 'IT',
671
            'JAM' => 'JM',
672
            'JOR' => 'JO',
673
            'JPN' => 'JP',
674
            'KAZ' => 'KZ',
675
            'KEN' => 'KE',
676
            'KGZ' => 'KG',
677
            'KHM' => 'KH',
678
            'KIR' => 'KI',
679
            'KNA' => 'KN',
680
            'KOR' => 'KO',
681
            'KWT' => 'KW',
682
            'LAO' => 'LA',
683
            'LBN' => 'LB',
684
            'LBR' => 'LR',
685
            'LBY' => 'LY',
686
            'LCA' => 'LC',
687
            'LIE' => 'LI',
688
            'LKA' => 'LK',
689
            'LSO' => 'LS',
690
            'LTU' => 'LT',
691
            'LUX' => 'LU',
692
            'LVA' => 'LV',
693
            'MAC' => 'MO',
694
            'MAR' => 'MA',
695
            'MCO' => 'MC',
696
            'MDA' => 'MD',
697
            'MDG' => 'MG',
698
            'MDV' => 'MV',
699
            'MEX' => 'MX',
700
            'MHL' => 'MH',
701
            'MKD' => 'MK',
702
            'MLI' => 'ML',
703
            'MLT' => 'MT',
704
            'MMR' => 'MM',
705
            'MNG' => 'MN',
706
            'MNP' => 'MP',
707
            'MNT' => 'ME',
708
            'MOZ' => 'MZ',
709
            'MRT' => 'MR',
710
            'MSR' => 'MS',
711
            'MTQ' => 'MQ',
712
            'MUS' => 'MU',
713
            'MWI' => 'MW',
714
            'MYS' => 'MY',
715
            'MYT' => 'YT',
716
            'NAM' => 'NA',
717
            'NCL' => 'NC',
718
            'NER' => 'NE',
719
            'NFK' => 'NF',
720
            'NGA' => 'NG',
721
            'NIC' => 'NI',
722
            'NIR' => 'GB',
723
            'NIU' => 'NU',
724
            'NLD' => 'NL',
725
            'NOR' => 'NO',
726
            'NPL' => 'NP',
727
            'NRU' => 'NR',
728
            'NZL' => 'NZ',
729
            'OMN' => 'OM',
730
            'PAK' => 'PK',
731
            'PAN' => 'PA',
732
            'PCN' => 'PN',
733
            'PER' => 'PE',
734
            'PHL' => 'PH',
735
            'PLW' => 'PW',
736
            'PNG' => 'PG',
737
            'POL' => 'PL',
738
            'PRI' => 'PR',
739
            'PRK' => 'KP',
740
            'PRT' => 'PT',
741
            'PRY' => 'PY',
742
            'PSE' => 'PS',
743
            'PYF' => 'PF',
744
            'QAT' => 'QA',
745
            'REU' => 'RE',
746
            'ROM' => 'RO',
747
            'RUS' => 'RU',
748
            'RWA' => 'RW',
749
            'SAU' => 'SA',
750
            'SCT' => 'GB',
751
            'SDN' => 'SD',
752
            'SEN' => 'SN',
753
            'SER' => 'RS',
754
            'SGP' => 'SG',
755
            'SGS' => 'GS',
756
            'SHN' => 'SH',
757
            'SJM' => 'SJ',
758
            'SLB' => 'SB',
759
            'SLE' => 'SL',
760
            'SLV' => 'SV',
761
            'SMR' => 'SM',
762
            'SOM' => 'SO',
763
            'SPM' => 'PM',
764
            'STP' => 'ST',
765
            'SUR' => 'SR',
766
            'SVK' => 'SK',
767
            'SVN' => 'SI',
768
            'SWE' => 'SE',
769
            'SWZ' => 'SZ',
770
            'SYC' => 'SC',
771
            'SYR' => 'SY',
772
            'TCA' => 'TC',
773
            'TCD' => 'TD',
774
            'TGO' => 'TG',
775
            'THA' => 'TH',
776
            'TJK' => 'TJ',
777
            'TKL' => 'TK',
778
            'TKM' => 'TM',
779
            'TLS' => 'TL',
780
            'TON' => 'TO',
781
            'TTO' => 'TT',
782
            'TUN' => 'TN',
783
            'TUR' => 'TR',
784
            'TUV' => 'TV',
785
            'TWN' => 'TW',
786
            'TZA' => 'TZ',
787
            'UGA' => 'UG',
788
            'UKR' => 'UA',
789
            'UMI' => 'UM',
790
            'URY' => 'UY',
791
            'USA' => 'US',
792
            'UZB' => 'UZ',
793
            'VAT' => 'VA',
794
            'VCT' => 'VC',
795
            'VEN' => 'VE',
796
            'VGB' => 'VG',
797
            'VIR' => 'VI',
798
            'VNM' => 'VN',
799
            'VUT' => 'VU',
800
            'WLF' => 'WF',
801
            'WLS' => 'GB',
802
            'WSM' => 'WS',
803
            'YEM' => 'YE',
804
            'ZAF' => 'ZA',
805
            'ZMB' => 'ZM',
806
            'ZWE' => 'ZW',
807
        ];
808
    }
809
810
    /**
811
     * Returns the translated country name based on the given two letter country code.
812
     *
813
     * @param string $twoLetterCode The two letter country code
814
     *
815
     * @return string
816
     */
817
    public function mapTwoLetterToName(string $twoLetterCode): string
818
    {
819
        $threeLetterCode = array_search($twoLetterCode, $this->iso3166(), true);
820
        $threeLetterCode = $threeLetterCode ?: '???';
821
822
        return $this->getAllCountries()[$threeLetterCode];
823
    }
824
}
825