-
Notifications
You must be signed in to change notification settings - Fork 10
/
Country.php
147 lines (142 loc) · 3.61 KB
/
Country.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
declare(strict_types=1);
namespace GenderDetector;
use function mb_strtoupper;
enum Country
{
case GreatBritain;
case Ireland;
case Usa;
case Italy;
case Malta;
case Portugal;
case Spain;
case France;
case Belgium;
case Luxembourg;
case TheNetherlands;
case EastFrisia;
case Germany;
case Austria;
case Swiss;
case Iceland;
case Denmark;
case Norway;
case Sweden;
case Finland;
case Estonia;
case Latvia;
case Lithuania;
case Poland;
case CzechRepublic;
case Slovakia;
case Hungary;
case Romania;
case Bulgaria;
case BosniaAndHerzegovina;
case Croatia;
case Kosovo;
case NorthMacedonia;
case Montenegro;
case Serbia;
case Slovenia;
case Albania;
case Greece;
case Russia;
case Belarus;
case Moldova;
case Ukraine;
case Armenia;
case Azerbaijan;
case Georgia;
case Kazakhstan;
case Kyrgyzstan;
case Tajikistan;
case Turkmenistan;
case Uzbekistan;
case Turkey;
case Arabia;
case Iran;
case Israel;
case China;
case India;
case SriLanka;
case Japan;
case Korea;
case Vietnam;
case OtherCountries;
public static function fromISO3166(string $iso3166): self
{
return match (mb_strtoupper($iso3166)) {
'GB' => self::GreatBritain,
'IE' => self::Ireland,
'AU',
'CA',
'US' => self::Usa,
'IT' => self::Italy,
'MT' => self::Malta,
'PT' => self::Portugal,
'ES' => self::Spain,
'FR' => self::France,
'BE' => self::Belgium,
'LU' => self::Luxembourg,
'NL' => self::TheNetherlands,
'DE' => self::Germany,
'AT' => self::Austria,
'CH' => self::Swiss,
'IS' => self::Iceland,
'DK' => self::Denmark,
'NO' => self::Norway,
'SE' => self::Sweden,
'FI' => self::Finland,
'EE' => self::Estonia,
'LV' => self::Latvia,
'LT' => self::Lithuania,
'PL' => self::Poland,
'CZ' => self::CzechRepublic,
'SK' => self::Slovakia,
'HU' => self::Hungary,
'RO' => self::Romania,
'BG' => self::Bulgaria,
'BA' => self::BosniaAndHerzegovina,
'HR' => self::Croatia,
'XK' => self::Kosovo,
'MK' => self::NorthMacedonia,
'ME' => self::Montenegro,
'RS' => self::Serbia,
'SI' => self::Slovenia,
'AL' => self::Albania,
'GR' => self::Greece,
'RU' => self::Russia,
'BY' => self::Belarus,
'MD' => self::Moldova,
'UA' => self::Ukraine,
'AM' => self::Armenia,
'AZ' => self::Azerbaijan,
'GE' => self::Georgia,
'KZ' => self::Kazakhstan,
'KG' => self::Kyrgyzstan,
'TJ' => self::Tajikistan,
'TM' => self::Turkmenistan,
'UZ' => self::Uzbekistan,
'TR' => self::Turkey,
'AE',
'QA',
'SA',
'BH',
'EG' => self::Arabia,
'CN',
'HK',
'TW' => self::China,
'IN' => self::India,
'JP' => self::Japan,
'KP',
'KR' => self::Korea,
'VN' => self::Vietnam,
'LK' => self::SriLanka,
'IR' => self::Iran,
'IL' => self::Israel,
default => self::OtherCountries,
};
}
}