Skip to content

Commit

Permalink
Add short country code variant
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank committed Mar 19, 2023
1 parent 55d30b7 commit 3c92884
Show file tree
Hide file tree
Showing 4 changed files with 1,133 additions and 0 deletions.
282 changes: 282 additions & 0 deletions src/CountryShort/CountryAlpha2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
<?php
declare(strict_types=1);

namespace PrinsFrank\Standards\CountryShort;

use PrinsFrank\Standards\BackedEnum;

/**
* @source https://www.iso.org/obp/ui/#search/code/
*/
enum CountryAlpha2: string
{
case Afghanistan = 'AF';
case Aland_Islands = 'AX';
case Albania = 'AL';
case Algeria = 'DZ';
case American_Samoa = 'AS';
case Andorra = 'AD';
case Angola = 'AO';
case Anguilla = 'AI';
case Antarctica = 'AQ';
case Antigua_and_Barbuda = 'AG';
case Argentina = 'AR';
case Armenia = 'AM';
case Aruba = 'AW';
case Australia = 'AU';
case Austria = 'AT';
case Azerbaijan = 'AZ';
case Bahamas = 'BS';
case Bahrain = 'BH';
case Bangladesh = 'BD';
case Barbados = 'BB';
case Belarus = 'BY';
case Belgium = 'BE';
case Belize = 'BZ';
case Benin = 'BJ';
case Bermuda = 'BM';
case Bhutan = 'BT';
case Bolivia_Plurinational_State = 'BO';
case Bonaire_Sint_Eustatius_and_Saba = 'BQ';
case Bosnia_and_Herzegovina = 'BA';
case Botswana = 'BW';
case Bouvet_Island = 'BV';
case Brazil = 'BR';
case British_Indian_Ocean_Territory = 'IO';
case Brunei_Darussalam = 'BN';
case Bulgaria = 'BG';
case Burkina_Faso = 'BF';
case Burundi = 'BI';
case Cabo_Verde = 'CV';
case Cambodia = 'KH';
case Cameroon = 'CM';
case Canada = 'CA';
case Cayman_Islands = 'KY';
case Central_African_Republic = 'CF';
case Chad = 'TD';
case Chile = 'CL';
case China = 'CN';
case Christmas_Island = 'CX';
case Cocos_Keeling_Islands = 'CC';
case Colombia = 'CO';
case Comoros = 'KM';
case Congo = 'CG';
case Congo_Democratic_Republic = 'CD';
case Cook_Islands = 'CK';
case Costa_Rica = 'CR';
case Cote_d_Ivoire = 'CI';
case Croatia = 'HR';
case Cuba = 'CU';
case Curacao = 'CW';
case Cyprus = 'CY';
case Czechia = 'CZ';
case Denmark = 'DK';
case Djibouti = 'DJ';
case Dominica = 'DM';
case Dominican_Republic = 'DO';
case Ecuador = 'EC';
case Egypt = 'EG';
case El_Salvador = 'SV';
case Equatorial_Guinea = 'GQ';
case Eritrea = 'ER';
case Estonia = 'EE';
case Eswatini = 'SZ';
case Ethiopia = 'ET';
case Falkland_Islands = 'FK';
case Faroe_Islands = 'FO';
case Fiji = 'FJ';
case Finland = 'FI';
case France = 'FR';
case French_Guiana = 'GF';
case French_Polynesia = 'PF';
case French_Southern_Territories = 'TF';
case Gabon = 'GA';
case Gambia = 'GM';
case Georgia = 'GE';
case Germany = 'DE';
case Ghana = 'GH';
case Gibraltar = 'GI';
case Greece = 'GR';
case Greenland = 'GL';
case Grenada = 'GD';
case Guadeloupe = 'GP';
case Guam = 'GU';
case Guatemala = 'GT';
case Guernsey = 'GG';
case Guinea = 'GN';
case Guinea_Bissau = 'GW';
case Guyana = 'GY';
case Haiti = 'HT';
case Heard_and_McDonald_Islands = 'HM';
case Holy_See = 'VA';
case Honduras = 'HN';
case Hong_Kong = 'HK';
case Hungary = 'HU';
case Iceland = 'IS';
case India = 'IN';
case Indonesia = 'ID';
case Iran_Islamic_Republic = 'IR';
case Iraq = 'IQ';
case Ireland = 'IE';
case Isle_of_Man = 'IM';
case Israel = 'IL';
case Italy = 'IT';
case Jamaica = 'JM';
case Japan = 'JP';
case Jersey = 'JE';
case Jordan = 'JO';
case Kazakhstan = 'KZ';
case Kenya = 'KE';
case Kiribati = 'KI';
case Korea_Democratic_Peoples_Republic = 'KP';
case Korea_Republic = 'KR';
case Kuwait = 'KW';
case Kyrgyzstan = 'KG';
case Lao = 'LA';
case Latvia = 'LV';
case Lebanon = 'LB';
case Lesotho = 'LS';
case Liberia = 'LR';
case Libya = 'LY';
case Liechtenstein = 'LI';
case Lithuania = 'LT';
case Luxembourg = 'LU';
case Macao = 'MO';
case Madagascar = 'MG';
case Malawi = 'MW';
case Malaysia = 'MY';
case Maldives = 'MV';
case Mali = 'ML';
case Malta = 'MT';
case Marshall_Islands = 'MH';
case Martinique = 'MQ';
case Mauritania = 'MR';
case Mauritius = 'MU';
case Mayotte = 'YT';
case Mexico = 'MX';
case Micronesia = 'FM';
case Moldova = 'MD';
case Monaco = 'MC';
case Mongolia = 'MN';
case Montenegro = 'ME';
case Montserrat = 'MS';
case Morocco = 'MA';
case Mozambique = 'MZ';
case Myanmar = 'MM';
case Namibia = 'NA';
case Nauru = 'NR';
case Nepal = 'NP';
case Netherlands = 'NL';
case New_Caledonia = 'NC';
case New_Zealand = 'NZ';
case Nicaragua = 'NI';
case Niger = 'NE';
case Nigeria = 'NG';
case Niue = 'NU';
case Norfolk_Island = 'NF';
case North_Macedonia = 'MK';
case Northern_Mariana_Islands = 'MP';
case Norway = 'NO';
case Oman = 'OM';
case Pakistan = 'PK';
case Palau = 'PW';
case Palestine = 'PS';
case Panama = 'PA';
case Papua_New_Guinea = 'PG';
case Paraguay = 'PY';
case Peru = 'PE';
case Philippines = 'PH';
case Pitcairn = 'PN';
case Poland = 'PL';
case Portugal = 'PT';
case Puerto_Rico = 'PR';
case Qatar = 'QA';
case Reunion = 'RE';
case Romania = 'RO';
case Russian_Federation = 'RU';
case Rwanda = 'RW';
case Saint_Barthelemy = 'BL';
case Saint_Helena_Ascension_Tristan_da_Cunha = 'SH';
case Saint_Kitts_and_Nevis = 'KN';
case Saint_Lucia = 'LC';
case Saint_Martin_French_part = 'MF';
case Saint_Pierre_and_Miquelon = 'PM';
case Saint_Vincent_and_the_Grenadines = 'VC';
case Samoa = 'WS';
case San_Marino = 'SM';
case Sao_Tome_and_Principe = 'ST';
case Saudi_Arabia = 'SA';
case Senegal = 'SN';
case Serbia = 'RS';
case Seychelles = 'SC';
case Sierra_Leone = 'SL';
case Singapore = 'SG';
case Sint_Maarten_Dutch_part = 'SX';
case Slovakia = 'SK';
case Slovenia = 'SI';
case Solomon_Islands = 'SB';
case Somalia = 'SO';
case South_Africa = 'ZA';
case South_Georgia_South_Sandwich_Islands = 'GS';
case South_Sudan = 'SS';
case Spain = 'ES';
case Sri_Lanka = 'LK';
case Sudan = 'SD';
case Suriname = 'SR';
case Svalbard_Jan_Mayen = 'SJ';
case Sweden = 'SE';
case Switzerland = 'CH';
case Syrian_Arab_Republic = 'SY';
case Taiwan_Province_of_China = 'TW';
case Tajikistan = 'TJ';
case Tanzania = 'TZ';
case Thailand = 'TH';
case Timor_Leste = 'TL';
case Togo = 'TG';
case Tokelau = 'TK';
case Tonga = 'TO';
case Trinidad_and_Tobago = 'TT';
case Tunisia = 'TN';
case Turkey = 'TR';
case Turkmenistan = 'TM';
case Turks_and_Caicos_Islands = 'TC';
case Tuvalu = 'TV';
case Uganda = 'UG';
case Ukraine = 'UA';
case United_Arab_Emirates = 'AE';
case United_Kingdom = 'GB';
case United_States_Outlying_Islands = 'UM';
case United_States_of_America = 'US';
case Uruguay = 'UY';
case Uzbekistan = 'UZ';
case Vanuatu = 'VU';
case Venezuela = 'VE';
case Viet_Nam = 'VN';
case Virgin_Islands_British = 'VG';
case Virgin_Islands_U_S = 'VI';
case Wallis_and_Futuna = 'WF';
case Western_Sahara = 'EH';
case Yemen = 'YE';
case Zambia = 'ZM';
case Zimbabwe = 'ZW';

public function toISO3166_1_Alpha_3(): CountryAlpha3
{
return BackedEnum::fromKey(CountryAlpha3::class, $this->name);
}

public function toISO3166_1_Numeric(): CountryNumeric
{
return BackedEnum::fromKey(CountryNumeric::class, $this->name);
}

public function toISO3166_Name(): CountryName
{
return BackedEnum::fromKey(CountryName::class, $this->name);
}

public function lowerCaseValue(): string
{
return strtolower($this->value);
}
}
Loading

0 comments on commit 3c92884

Please sign in to comment.