Initial xentral_oss_20.3.c9ffacf

This commit is contained in:
Alex
2021-05-21 08:49:41 +02:00
parent 5406e4a551
commit 34e5ac43d9
18884 changed files with 2109867 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace Xentral\Modules\Country;
use Xentral\Core\DependencyInjection\ContainerInterface;
use Xentral\Modules\Country\Gateway\CountryGateway;
use Xentral\Modules\Country\Gateway\StateGateway;
use Xentral\Modules\Country\Service\CountryMigrationService;
use Xentral\Modules\Country\Service\CountryService;
final class Bootstrap
{
/**
* @return array
*/
public static function registerServices()
{
return [
'CountryGateway' => 'onInitCountryGateway',
'CountryService' => 'onInitCountryService',
'CountryMigrationService' => 'onInitCountryMigrationService',
StateGateway::class => 'onInitStateGateway',
];
}
/**
* @param ContainerInterface $container
*
* @return CountryGateway
*/
public static function onInitCountryGateway(ContainerInterface $container)
{
return new CountryGateway($container->get('Database'));
}
/**
* @param ContainerInterface $container
*
* @return CountryService
*/
public static function onInitCountryService(ContainerInterface $container)
{
return new CountryService($container->get('CountryGateway'), $container->get('Database'));
}
/**
* @param ContainerInterface $container
*
* @return CountryMigrationService
*/
public static function onInitCountryMigrationService(ContainerInterface $container)
{
return new CountryMigrationService($container->get('Database'));
}
/**
* @param ContainerInterface $container
*
* @return StateGateway
*/
public static function onInitStateGateway(ContainerInterface $container): StateGateway
{
return new StateGateway($container->get('Database'));
}
}
@@ -0,0 +1,117 @@
<?php
namespace Xentral\Modules\Country\Data;
final class CountryData
{
/** @var string $isoAlpha2 */
private $isoAlpha2;
/** @var string $isoAlpha3 */
private $isoAlpha3;
/** @var string $isoNumeric */
private $isoNumeric;
/** @var string $nameGerman */
private $nameGerman;
/** @var string $nameEnglish */
private $nameEnglish;
/** @var bool $isEu */
private $isEu;
/**
* @param string $isoAlpha2 ISO 3166 ALPHA-2
* @param string $isoAlpha3 ISO 3166 ALPHA-3
* @param string $isoNumeric ISO 3166 numeric
* @param string $nameGerman German name
* @param string $nameEnglish English name
* @param bool $isEu
*/
public function __construct($isoAlpha2, $isoAlpha3, $isoNumeric, $nameGerman, $nameEnglish, $isEu)
{
$validator = new CountryDataValidator();
$validator->ensureIso2($isoAlpha2);
$validator->ensureIso3($isoAlpha3);
if ($isoAlpha2 !== 'XK' /* Kosovo has no numeric id */) {
$validator->ensureIsoNumeric($isoNumeric);
}
$validator->ensureNameGerman($nameGerman);
$validator->ensureNameEnglish($nameEnglish);
$validator->ensureIsEu($isEu);
$this->isoAlpha2 = $isoAlpha2;
$this->isoAlpha3 = $isoAlpha3;
$this->isoNumeric = $isoNumeric;
$this->nameGerman = $nameGerman;
$this->nameEnglish = $nameEnglish;
$this->isEu = $isEu;
}
/**
* @param array $state
*
* @return CountryData
*/
public static function fromState(array $state)
{
return new self(
$state['iso2_code'],
$state['iso3_code'],
$state['num_code'],
$state['name_de'],
$state['name_en'],
(bool)$state['is_eu']
);
}
/**
* @return string
*/
public function getIsoAlpha2()
{
return $this->isoAlpha2;
}
/**
* @return string
*/
public function getIsoAlpha3()
{
return $this->isoAlpha3;
}
/**
* @return string
*/
public function getIsoNumeric()
{
return $this->isoNumeric;
}
/**
* @return string
*/
public function getNameGerman()
{
return $this->nameGerman;
}
/**
* @return string
*/
public function getNameEnglish()
{
return $this->nameEnglish;
}
/**
* @return bool
*/
public function isEu()
{
return $this->isEu;
}
}
@@ -0,0 +1,70 @@
<?php
namespace Xentral\Modules\Country\Data;
use Xentral\Modules\Country\Exception\CountryInvalidArgumentException;
class CountryDataValidator
{
/**
* @param $isoAlpha3
*/
public function ensureIso3($isoAlpha3)
{
if (strlen($isoAlpha3) !== 3) {
throw new CountryInvalidArgumentException('ISO-3166-Alpha3-Feld ist nicht 3 Zeichen lang');
}
}
/**
* @param $isoAlpha2
*/
public function ensureIso2($isoAlpha2)
{
if (strlen($isoAlpha2) !== 2) {
throw new CountryInvalidArgumentException('ISO-3166-Alpha2-Feld ist nicht 2 Zeichen lang');
}
}
/**
* @param $isoNumeric
*/
public function ensureIsoNumeric($isoNumeric)
{
if (strlen($isoNumeric) !== 3) {
throw new CountryInvalidArgumentException(
'Numerischer Ländercode (ISO-3166 numeric) ist nicht 3 Zeichen lang'
);
}
}
/**
* @param $nameGerman
*/
public function ensureNameGerman($nameGerman)
{
if (trim($nameGerman) === '') {
throw new CountryInvalidArgumentException('Deutsche Bezeichnung ist leer');
}
}
/**
* @param $nameEnglish
*/
public function ensureNameEnglish($nameEnglish)
{
if (trim($nameEnglish) === '') {
throw new CountryInvalidArgumentException('Englische Bezeichnung ist leer');
}
}
/**
* @param $isEu
*/
public function ensureIsEu($isEu)
{
if (!is_bool($isEu)) {
throw new CountryInvalidArgumentException('Fehlerhafter EU-Parameter. Es sind nur boolsche Werte erlaubt.');
}
}
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Modules\Country\Exception;
use Xentral\Core\Exception\ModuleExceptionInterface;
interface CountryExceptionInterface extends ModuleExceptionInterface
{
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Modules\Country\Exception;
use InvalidArgumentException;
class CountryInvalidArgumentException extends InvalidArgumentException implements CountryExceptionInterface
{
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Modules\Country\Exception;
use RuntimeException;
class CountryMigrationFailedException extends RuntimeException implements CountryExceptionInterface
{
}
@@ -0,0 +1,9 @@
<?php
namespace Xentral\Modules\Country\Exception;
use RuntimeException;
class CountryNotFoundException extends RuntimeException implements CountryExceptionInterface
{
}
@@ -0,0 +1,126 @@
<?php
namespace Xentral\Modules\Country\Gateway;
use Xentral\Components\Database\Database;
use Xentral\Modules\Country\Data\CountryDataValidator;
final class CountryGateway
{
/** @var Database $db */
private $db;
/** @var CountryDataValidator */
private $validator;
/**
* @param Database $database
*/
public function __construct(Database $database)
{
$this->db = $database;
$this->validator = new CountryDataValidator();
}
/**
* @return array
*/
public function findAll()
{
return $this->db->fetchAll('SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM laender AS l;');
}
/**
* @param string $name
*
* @return array|null
*/
public function findByName($name)
{
$this->validator->ensureNameGerman($name);
$sql = 'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM laender AS l
WHERE bezeichnung_de LIKE :name OR bezeichnung_en LIKE :name;';
return $this->db->fetchRow($sql, ['name' => $name]);
}
/**
* @param string $iso2Code
*
* @return array|null
*/
public function findByIso2Code($iso2Code)
{
$this->validator->ensureIso2($iso2Code);
$result = $this->db->fetchRow(
'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM laender AS l
WHERE iso = :iso2_code;',
['iso2_code' => $iso2Code]
);
// TODO throw Exception
return $result;
}
/**
* @param string $iso3Code
*
* @return array|null
*/
public function findByIso3Code($iso3Code)
{
$this->validator->ensureIso3($iso3Code);
$result = $this->db->fetchRow(
'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM laender AS l
WHERE iso3 = :iso3_code;',
['iso3_code' => $iso3Code]
);
// TODO throw Exception
return $result;
}
/**
* @param string $numericCode
*
* @return array|null
*/
public function findByNumericCode($numericCode)
{
$this->validator->ensureIsoNumeric($numericCode);
$result = $this->db->fetchRow(
'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM laender AS l
WHERE num_code = :num_code;',
['num_code' => $numericCode]
);
// TODO throw Exception
return $result;
}
/**
* Returns sql-ready 'column AS arrayName' structure
*
* @return string
*/
private function getColumnArraySQLMapping()
{
return
'l.iso AS iso2_code,
l.iso3 AS iso3_code,
l.num_code AS num_code,
l.bezeichnung_de AS name_de,
l.bezeichnung_en AS name_en,
l.eu AS is_eu ';
}
}
@@ -0,0 +1,95 @@
<?php
declare(strict_types=1);
namespace Xentral\Modules\Country\Gateway;
use Xentral\Components\Database\Database;
use Xentral\Modules\Country\Data\CountryDataValidator;
final class StateGateway
{
/** @var Database $db */
private $db;
/** @var CountryDataValidator */
private $validator;
/**
* @param Database $database
*/
public function __construct(Database $database)
{
$this->db = $database;
$this->validator = new CountryDataValidator();
}
/**
* @param string $name state name
* @param string $iso2CountryCode iso2 country code
*
* @return array
*/
public function findByNameAndIso2CountryCode(string $name, string $iso2CountryCode): array
{
$this->validator->ensureNameGerman($name);
$this->validator->ensureIso2($iso2CountryCode);
$sql = 'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM `bundesstaaten` AS s
WHERE s.bundesstaat = :name AND s.aktiv = 1 AND s.land = :country_code';
return $this->db->fetchRow($sql, ['name' => $name, 'country_code' => $iso2CountryCode]);
}
/**
* @param string $iso2Code iso state code
* @param string $iso2CountryCode iso2 country code
*
* @return array
*/
public function findByIso2CodeAndIso2CountryCode(string $iso2Code, string $iso2CountryCode): array
{
$this->validator->ensureIso2($iso2CountryCode);
return $this->db->fetchRow(
'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM `bundesstaaten` AS s
WHERE s.iso = :iso2_code AND s.aktiv = 1 AND s.land = :country_code',
['iso2_code' => $iso2Code, 'country_code' => $iso2CountryCode]
);
}
/**
* @param string $iso2CountryCode
*
* @return array
*/
public function findAllByCountryCode(string $iso2CountryCode): array
{
$this->validator->ensureIso2($iso2CountryCode);
return $this->db->fetchAll(
'SELECT ' .
$this->getColumnArraySQLMapping() .
'FROM `bundesstaaten` AS s
WHERE s.land = :iso2_code AND s.aktiv = 1',
['iso2_code' => $iso2CountryCode]
);
}
/**
* Returns sql-ready 'column AS arrayName' structure
*
* @return string
*/
private function getColumnArraySQLMapping(): string
{
return
's.iso AS iso2_code,
s.land AS iso2_country_code,
s.bundesstaat AS name_de ';
}
}
@@ -0,0 +1,132 @@
<?php
namespace Xentral\Modules\Country\Service;
use Xentral\Components\Database\Database;
use Xentral\Modules\Country\Data\CountryData;
use Xentral\Modules\Country\Exception\CountryMigrationFailedException;
final class CountryMigrationService
{
/** @var Database $db */
private $db;
/**
* @param Database $database
*/
public function __construct(Database $database)
{
$this->db = $database;
}
/**
* Migration notwendig?
*
* * Prüft ob Länderliste in Datenbank vollständig
* * Prüft bei vorhandnen Ländern ob ISO3-Code in Datenbank gefüllt
*
* @param string $tableName
*
* @return bool
*/
public function needsMigration($tableName = 'laender')
{
$countries = $this->getCountryList();
$countryCodes = array_map(function ($country) {
/** @var CountryData $country */
return $country->getIsoAlpha2();
}, $countries);
// Check for empty ISO3 codes on existing entries
$emptyIso3Count = (int)$this->db->fetchValue(
"SELECT COUNT(*)
FROM {$tableName} AS l
WHERE l.iso IN (:country_codes)
AND (l.iso3 IS NULL OR l.iso3 = '')",
['country_codes' => $countryCodes]
);
if ($emptyIso3Count > 0) {
return true;
}
// Check for missing countries
$existingCount = (int)$this->db->fetchValue(
"SELECT COUNT(l.id) FROM {$tableName} AS l WHERE l.iso IN (:country_codes)",
['country_codes' => $countryCodes]
);
if ($existingCount !== count($countries)) {
return true;
}
return false;
}
/**
* @param string $tableName
*
* @return void
*/
public function doMigration($tableName = 'laender')
{
$countries = $this->getCountryList();
$iso2List = array_map(function ($country){
/** @var CountryData $country */
return '(SELECT "' . $this->db->escapeValue($country->getIsoAlpha2()) . '" AS iso2_orig,
"' . $this->db->escapeValue($country->getIsoAlpha3()) . '" AS iso3_orig,
"' . $this->db->escapeValue($country->getIsoNumeric()) . '" AS num_orig,
"' . $this->db->escapeValue($country->getNameGerman()) . '" AS name_de_orig,
"' . $this->db->escapeValue($country->getNameEnglish()) . '" AS name_en_orig,
"' . $this->db->escapeValue((int)$country->isEu()) . '" AS is_eu_orig)';
}, $countries);
$sqlIsoData = implode(' UNION ', $iso2List);
$missingValues = $this->db->fetchAll("SELECT * FROM {$tableName} AS l
RIGHT JOIN ({$sqlIsoData}) AS iso_data
ON l.iso=iso_data.iso2_orig
WHERE l.iso IS NULL OR l.iso = '' OR l.iso3 != iso_data.iso3_orig
");
//TODO check is ISO2 present multiple times
foreach ($missingValues as $missingValue){
if($missingValue['id'] == null){
// whole entry missing
$this->db->perform(
"INSERT INTO {$tableName}(iso, iso3, num_code, bezeichnung_de, bezeichnung_en, eu)
VALUES (:iso2_code, :iso3_code, :num_code, :name_de, :name_en, :is_eu)",
[
'iso2_code' => $missingValue['iso2_orig'],
'iso3_code' => $missingValue['iso3_orig'],
'num_code' => $missingValue['num_orig'],
'name_de' => $missingValue['name_de_orig'],
'name_en' => $missingValue['name_en_orig'],
'is_eu' => $missingValue['is_eu_orig'],
]
);
}else{
// entry corrupted/iso3 missing
$this->db->perform(
"UPDATE {$tableName} SET iso3 = :iso3_code, num_code = :num_code WHERE iso = :iso2_code LIMIT 1",
[
'iso2_code' => $missingValue['iso2_orig'],
'iso3_code' => $missingValue['iso3_orig'],
'num_code' => $missingValue['num_orig'],
]
);
}
}
}
/**
* @return CountryData[]
*/
public function getCountryList()
{
$countryArray = include __DIR__ . '/../migration/iso_code_data.php';
return array_map(function ($country) {
return new CountryData($country[0], $country[1], $country[2], $country[3], $country[4], (bool)$country[5]);
}, $countryArray);
}
}
@@ -0,0 +1,156 @@
<?php
namespace Xentral\Modules\Country\Service;
use Xentral\Components\Database\Database;
use Xentral\Modules\Country\Data\CountryData;
use Xentral\Modules\Country\Exception\CountryNotFoundException;
use Xentral\Modules\Country\Gateway\CountryGateway;
final class CountryService
{
/** @var CountryGateway $gateway */
private $gateway;
/** @var Database $db */
private $db;
/**
* @param CountryGateway $gateway
* @param Database $database
*/
public function __construct(CountryGateway $gateway, Database $database)
{
$this->gateway = $gateway;
$this->db = $database;
}
/**
* @param string $iso3Code
*
* @return CountryData
*/
public function getByIso3Code($iso3Code)
{
$state = $this->gateway->findByIso3Code($iso3Code);
if (empty($state)) {
throw new CountryNotFoundException("ISO3-Code '{$iso3Code}' nicht gefunden");
}
return CountryData::fromState($state);
// @todo Exception werfen wenn Gateway kein Ergebnis liefert
// @todo Exception werfen wenn Daten unvollständig => An entsprechender Stelle Exception abfangen und
// in Oberflächen-Fehlermeldung umwandeln
}
/**
* @param string $iso2Code
*
* @return CountryData
*/
public function getByIso2Code($iso2Code)
{
$state = $this->gateway->findByIso2Code($iso2Code);
if (empty($state)) {
throw new CountryNotFoundException("ISO2-Code '{$iso2Code}' nicht gefunden");
}
return CountryData::fromState($state);
// @todo Exception werfen wenn Gateway kein Ergebnis liefert
// @todo Exception werfen wenn Daten unvollständig => An entsprechender Stelle Exception abfangen und
// in Oberflächen-Fehlermeldung umwandeln
}
/**
* @param string $name
*
* @return CountryData
*/
public function getByName($name)
{
$state = $this->gateway->findByName($name);
if (empty($state)) {
throw new CountryNotFoundException("Name '{$name}' nicht gefunden");
}
return CountryData::fromState($state);
// @todo Exception werfen wenn Gateway kein Ergebnis liefert
// @todo Exception werfen wenn Daten unvollständig => An entsprechender Stelle Exception abfangen und
// in Oberflächen-Fehlermeldung umwandeln
}
/**
* @param string $numericCode
*
* @return CountryData
*/
public function getByNumericCode($numericCode)
{
$state = $this->gateway->findByNumericCode($numericCode);
if (empty($state)) {
throw new CountryNotFoundException("Code '{$numericCode}' nicht gefunden");
}
return CountryData::fromState($state);
// @todo Exception werfen wenn Gateway kein Ergebnis liefert
// @todo Exception werfen wenn Daten unvollständig => An entsprechender Stelle Exception abfangen und
// in Oberflächen-Fehlermeldung umwandeln
}
/**
* @param CountryData $country
*
* @return void
*/
public function save(CountryData $country, $tableName = 'laender')
{
$sql = "SELECT COUNT(*) FROM {$tableName} WHERE iso = :iso2_code";
$matches = $this->db->fetchValue($sql, ['iso2_code' => $country->getIsoAlpha2()]);
if ($matches > 0) {
$sql =
"UPDATE {$tableName} SET
iso3 = :iso3_code,
bezeichnung_de = :name_de,
bezeichnung_en = :name_en,
eu = :is_eu,
num_code = :num_code
WHERE
iso=:iso2_code;";
$this->db->perform(
$sql,
[
'iso2_code' => $country->getIsoAlpha2(),
'iso3_code' => $country->getIsoAlpha3(),
'num_code' => $country->getIsoNumeric(),
'name_de' => $country->getNameGerman(),
'name_en' => $country->getNameEnglish(),
'is_eu' => $country->isEu(),
]
);
return;
}
$sql =
"INSERT INTO {$tableName}
(iso, iso3, num_code, bezeichnung_de, bezeichnung_en, eu)
VALUES
(:iso2_code, :iso3_code, :num_code, :name_de, :name_en, :is_eu);";
$this->db->perform(
$sql,
[
'iso2_code' => $country->getIsoAlpha2(),
'iso3_code' => $country->getIsoAlpha3(),
'num_code' => $country->getIsoNumeric(),
'name_de' => $country->getNameGerman(),
'name_en' => $country->getNameEnglish(),
'is_eu' => $country->isEu(),
]
);
}
}
@@ -0,0 +1,242 @@
<?php
return [
['AF', 'AFG', '004', 'Afghanistan', 'Afghanistan', false],
['EG', 'EGY', '818', 'Ägypten', 'Egypt', false],
['AL', 'ALB', '008', 'Albanien', 'Albania', false],
['DZ', 'DZA', '012', 'Algerien', 'Algeria', false],
['VI', 'VIR', '850', 'Amerikanische Jungferninseln', 'Virgin Islands (USA)', false],
['AD', 'AND', '020', 'Andorra', 'Andorra', false],
['AO', 'AGO', '024', 'Angola', 'Angola', false],
['AI', 'AIA', '660', 'Anguilla', 'Anguilla', false],
['AQ', 'ATA', '010', 'Antarktis', 'Antarctica', false],
['AG', 'ATG', '028', 'Antigua und Barbuda', 'Antigua and Barbuda', false],
['GQ', 'GNQ', '226', 'Äquatorialguinea', 'Equatorial Guinea', false],
['AR', 'ARG', '032', 'Argentinien', 'Argentina', false],
['AM', 'ARM', '051', 'Armenien', 'Armenia', false],
['AW', 'ABW', '533', 'Aruba', 'Aruba', false],
['AZ', 'AZE', '031', 'Aserbaidschan', 'Azerbaijan', false],
['ET', 'ETH', '231', 'Äthiopien', 'Ethiopia', false],
['AU', 'AUS', '036', 'Australien', 'Australia', false],
['BS', 'BHS', '044', 'Bahamas', 'Bahamas', false],
['BH', 'BHR', '048', 'Bahrain', 'Bahrain', false],
['BD', 'BGD', '050', 'Bangladesch', 'Bangladesh', false],
['BB', 'BRB', '052', 'Barbados', 'Barbados', false],
['BE', 'BEL', '056', 'Belgien', 'Belgium', true],
['BZ', 'BLZ', '084', 'Belize', 'Belize', false],
['BJ', 'BEN', '204', 'Benin', 'Benin', false],
['BM', 'BMU', '060', 'Bermuda', 'Bermuda', false],
['BT', 'BTN', '064', 'Bhutan', 'Bhutan', false],
['BO', 'BOL', '068', 'Bolivien', 'Bolivia', false],
['BA', 'BIH', '070', 'Bosnien und Herzegowina', 'Bosnia and Herzegovina', false],
['BW', 'BWA', '072', 'Botswana', 'Botswana', false],
['BV', 'BVT', '074', 'Bouvetinsel', 'Bouvet Island', false],
['BR', 'BRA', '076', 'Brasilien', 'Brazil', false],
['IO', 'IOT', '086', 'Britisch-Indischer Ozean', 'British Indian Ocean Territory', false],
['VG', 'VGB', '092', 'Britische Jungferninseln', 'Virgin Islands (Brit.)', false],
['BN', 'BRN', '096', 'Brunei Darussalam', 'Brunei Darussalam', false],
['BG', 'BGR', '100', 'Bulgarien', 'Bulgaria', true],
['BF', 'BFA', '854', 'Burkina Faso', 'Burkina Faso', false],
['BI', 'BDI', '108', 'Burundi', 'Burundi', false],
['CL', 'CHL', '152', 'Chile', 'Chile', false],
['CN', 'CHN', '156', 'China', 'China', false],
['CK', 'COK', '184', 'Cookinseln', 'Cook Islands', false],
['CR', 'CRI', '188', 'Costa Rica', 'Costa Rica', false],
['DK', 'DNK', '208', 'Dänemark', 'Denmark', true],
['DE', 'DEU', '276', 'Deutschland', 'Germany', true],
['DM', 'DMA', '212', 'Dominica', 'Dominica', false],
['DO', 'DOM', '214', 'Dominikanische Republik', 'Dominican Republic', false],
['DJ', 'DJI', '262', 'Dschibuti', 'Djibouti', false],
['EC', 'ECU', '218', 'Ecuador', 'Ecuador', false],
['SV', 'SLV', '222', 'El Salvador', 'El Salvador', false],
['ER', 'ERI', '232', 'Eritrea', 'Eritrea', false],
['EE', 'EST', '233', 'Estland', 'Estonia', true],
['FK', 'FLK', '238', 'Falklandinseln', 'Falkland Islands', false],
['FO', 'FRO', '234', 'Färöer Inseln', 'Faroe Islands', false],
['FJ', 'FJI', '242', 'Fidschi', 'Fiji', false],
['FI', 'FIN', '246', 'Finnland', 'Finland', true],
['FR', 'FRA', '250', 'Frankreich', 'France', true],
['GF', 'GUF', '254', 'Französisch-Guayana', 'French Guiana', false],
['PF', 'PYF', '258', 'Französisch-Polynesien', 'French Polynesia', false],
['TF', 'ATF', '260', 'Französisches Süd-Territorium', 'French Southern Territories', false],
['GA', 'GAB', '266', 'Gabun', 'Gabon', false],
['GM', 'GMB', '270', 'Gambia', 'Gambia', false],
['GE', 'GEO', '268', 'Georgien', 'Georgia', false],
['GH', 'GHA', '288', 'Ghana', 'Ghana', false],
['GI', 'GIB', '292', 'Gibraltar', 'Gibraltar', false],
['GD', 'GRD', '308', 'Grenada', 'Grenada', false],
['GR', 'GRC', '300', 'Griechenland', 'Greece', true],
['GL', 'GRL', '304', 'Grönland', 'Greenland', false],
['GB', 'GBR', '826', 'Großbritannien', 'Great Britain', true],
['GP', 'GLP', '312', 'Guadeloupe', 'Guadeloupe', false],
['GU', 'GUM', '316', 'Guam', 'Guam', false],
['GT', 'GTM', '320', 'Guatemala', 'Guatemala', false],
['GN', 'GIN', '324', 'Guinea', 'Guinea', false],
['GW', 'GNB', '624', 'Guinea-Bissau', 'Guinea-Bissau', false],
['GY', 'GUY', '328', 'Guyana', 'Guyana', false],
['HT', 'HTI', '332', 'Haiti', 'Haiti', false],
['HM', 'HMD', '334', 'Heard und McDonaldinseln', 'Heard Island and McDonald Islands', false],
['HN', 'HND', '340', 'Honduras', 'Honduras', false],
['HK', 'HKG', '344', 'Hongkong', 'Hong Kong', false],
['IN', 'IND', '356', 'Indien', 'India', false],
['ID', 'IDN', '360', 'Indonesien', 'Indonesia', false],
['IQ', 'IRQ', '368', 'Irak', 'Iraq', false],
['IR', 'IRN', '364', 'Iran', 'Iran', false],
['IE', 'IRL', '372', 'Irland', 'Ireland', true],
['IS', 'ISL', '352', 'Island', 'Iceland', false],
['IL', 'ISR', '376', 'Israel', 'Israel', false],
['IT', 'ITA', '380', 'Italien', 'Italy', true],
['JM', 'JAM', '388', 'Jamaika', 'Jamaica', false],
['JP', 'JPN', '392', 'Japan', 'Japan', false],
['YE', 'YEM', '887', 'Jemen', 'Yemen', false],
['JO', 'JOR', '400', 'Jordanien', 'Jordan', false],
['KY', 'CYM', '136', 'Kaimaninseln', 'Cayman Islands', false],
['KH', 'KHM', '116', 'Kambodscha', 'Cambodia', false],
['CM', 'CMR', '120', 'Kamerun', 'Cameroon', false],
['CA', 'CAN', '124', 'Kanada', 'Canada', false],
['CV', 'CPV', '132', 'Kap Verde', 'Cabo Verde', false],
['KZ', 'KAZ', '398', 'Kasachstan', 'Kazakhstan', false],
['QA', 'QAT', '634', 'Katar', 'Qatar', false],
['KE', 'KEN', '404', 'Kenia', 'Kenya', false],
['KG', 'KGZ', '417', 'Kirgisistan', 'Kyrgyzstan', false],
['KI', 'KIR', '296', 'Kiribati', 'Kiribati', false],
['CC', 'CCK', '166', 'Kokosinseln', 'Cocos Islands', false],
['CO', 'COL', '170', 'Kolumbien', 'Colombia', false],
['KM', 'COM', '174', 'Komoren', 'Comoros', false],
['CG', 'COG', '178', 'Kongo', 'Congo', false],
['CD', 'COD', '180', 'Kongo, Demokratische Republik', 'Congo (Democratic Republic)', false],
['XK', 'XKX', '', 'Kosovo', 'Kosovo', false],
['HR', 'HRV', '191', 'Kroatien', 'Croatia', true],
['CU', 'CUB', '192', 'Kuba', 'Cuba', false],
['KW', 'KWT', '414', 'Kuwait', 'Kuwait', false],
['LA', 'LAO', '418', 'Laos', 'Lao', false],
['LS', 'LSO', '426', 'Lesotho', 'Lesotho', false],
['LV', 'LVA', '428', 'Lettland', 'Latvia', true],
['LB', 'LBN', '422', 'Libanon', 'Lebanon', false],
['LR', 'LBR', '430', 'Liberia', 'Liberia', false],
['LY', 'LBY', '434', 'Libyen', 'Libya', false],
['LI', 'LIE', '438', 'Liechtenstein', 'Liechtenstein', false],
['LT', 'LTU', '440', 'Litauen', 'Lithuania', true],
['LU', 'LUX', '442', 'Luxemburg', 'Luxembourg', true],
['MO', 'MAC', '446', 'Macau', 'Macao', false],
['MG', 'MDG', '450', 'Madagaskar', 'Madagascar', false],
['MW', 'MWI', '454', 'Malawi', 'Malawi', false],
['MY', 'MYS', '458', 'Malaysia', 'Malaysia', false],
['MV', 'MDV', '462', 'Malediven', 'Maldives', false],
['ML', 'MLI', '466', 'Mali', 'Mali', false],
['MT', 'MLT', '470', 'Malta', 'Malta', true],
['MP', 'MNP', '580', 'Marianen', 'Northern Mariana Islands', false],
['MA', 'MAR', '504', 'Marokko', 'Morocco', false],
['MH', 'MHL', '584', 'Marshallinseln', 'Marshall Islands', false],
['MQ', 'MTQ', '474', 'Martinique', 'Martinique', false],
['MR', 'MRT', '478', 'Mauretanien', 'Mauritania', false],
['MU', 'MUS', '480', 'Mauritius', 'Mauritius', false],
['YT', 'MYT', '175', 'Mayotte', 'Mayotte', false],
['MK', 'MKD', '807', 'Mazedonien', 'Macedonia', false],
['MX', 'MEX', '484', 'Mexiko', 'Mexico', false],
['FM', 'FSM', '583', 'Mikronesien', 'Micronesia', false],
['MD', 'MDA', '498', 'Moldawien', 'Moldova', false],
['MC', 'MCO', '492', 'Monaco', 'Monaco', false],
['MN', 'MNG', '496', 'Mongolei', 'Mongolia', false],
['ME', 'MNE', '499', 'Montenegro', 'Montenegro', false],
['MS', 'MSR', '500', 'Montserrat', 'Montserrat', false],
['MZ', 'MOZ', '508', 'Mosambik', 'Mozambique', false],
['MM', 'MMR', '104', 'Myanmar', 'Myanmar', false],
['NA', 'NAM', '516', 'Namibia', 'Namibia', false],
['NR', 'NRU', '520', 'Nauru', 'Nauru', false],
['NP', 'NPL', '524', 'Nepal', 'Nepal', false],
['NC', 'NCL', '540', 'Neukaledonien', 'New Caledonia', false],
['NZ', 'NZL', '554', 'Neuseeland', 'New Zealand', false],
['NI', 'NIC', '558', 'Nicaragua', 'Nicaragua', false],
['NL', 'NLD', '528', 'Niederlande', 'Netherlands', true],
['NE', 'NER', '562', 'Niger', 'Niger', false],
['NG', 'NGA', '566', 'Nigeria', 'Nigeria', false],
['NU', 'NIU', '570', 'Niue', 'Niue', false],
['KP', 'PRK', '408', 'Nordkorea', 'Korea (Democratic Republic)', false],
['NF', 'NFK', '574', 'Norfolkinsel', 'Norfolk Island', false],
['NO', 'NOR', '578', 'Norwegen', 'Norway', false],
['OM', 'OMN', '512', 'Oman', 'Oman', false],
['AT', 'AUT', '040', 'Österreich', 'Austria', true],
['PK', 'PAK', '586', 'Pakistan', 'Pakistan', false],
['PS', 'PSE', '275', 'Palästina', 'Palestine', false],
['PW', 'PLW', '585', 'Palau', 'Palau', false],
['PA', 'PAN', '591', 'Panama', 'Panama', false],
['PG', 'PNG', '598', 'Papua-Neuguinea', 'Papua New Guinea', false],
['PY', 'PRY', '600', 'Paraguay', 'Paraguay', false],
['PE', 'PER', '604', 'Peru', 'Peru', false],
['PH', 'PHL', '608', 'Philippinen', 'Philippines', false],
['PN', 'PCN', '612', 'Pitcairninseln', 'Pitcairn', false],
['PL', 'POL', '616', 'Polen', 'Poland', true],
['PT', 'PRT', '620', 'Portugal', 'Portugal', true],
['PR', 'PRI', '630', 'Puerto Rico', 'Puerto Rico', false],
['RE', 'REU', '638', 'Réunion', 'Réunion', false],
['RW', 'RWA', '646', 'Ruanda', 'Rwanda', false],
['RO', 'ROU', '642', 'Rumänien', 'Romania', true],
['RU', 'RUS', '643', 'Russland', 'Russia', false],
['SB', 'SLB', '090', 'Salomonen', 'Solomon Islands', false],
['ZM', 'ZMB', '894', 'Sambia', 'Zambia', false],
['AS', 'ASM', '016', 'Samoa, amerikanisch', 'Samoa (American)', false],
['WS', 'WSM', '882', 'Samoa', 'Samoa', false],
['SM', 'SMR', '674', 'San Marino', 'San Marino', false],
['ST', 'STP', '678', 'São Tomé und Príncipe', 'Sao Tome and Principe', false],
['SA', 'SAU', '682', 'Saudi-Arabien', 'Saudi Arabia', false],
['SE', 'SWE', '752', 'Schweden', 'Sweden', true],
['CH', 'CHE', '756', 'Schweiz', 'Switzerland', false],
['SN', 'SEN', '686', 'Senegal', 'Senegal', false],
['RS', 'SRB', '688', 'Serbien', 'Serbia', false],
['SC', 'SYC', '690', 'Seychellen', 'Seychelles', false],
['SL', 'SLE', '694', 'Sierra Leone', 'Sierra Leone', false],
['ZW', 'ZWE', '716', 'Simbabwe', 'Zimbabwe', false],
['SG', 'SGP', '702', 'Singapur', 'Singapore', false],
['SK', 'SVK', '703', 'Slowakei', 'Slovakia', true],
['SI', 'SVN', '705', 'Slowenien', 'Slovenia', true],
['SO', 'SOM', '706', 'Somalia', 'Somalia', false],
['GS', 'SGS', '239', 'Südgeorgien, südliche Sandwichinseln', 'South Georgia, South Sandwich Isl.', false],
['ES', 'ESP', '724', 'Spanien', 'Spain', true],
['LK', 'LKA', '144', 'Sri Lanka', 'Sri Lanka', false],
['SH', 'SHN', '654', 'St. Helena', 'Saint Helena', false],
['KN', 'KNA', '659', 'St. Kitts und Nevis', 'Saint Kitts and Nevis', false],
['LC', 'LCA', '662', 'St. Lucia', 'Saint Lucia', false],
['PM', 'SPM', '666', 'St. Pierre und Miquelon', 'Saint Pierre and Miquelon', false],
['VC', 'VCT', '670', 'St. Vincent und die Grenadinen', 'Saint Vincent and the Grenadines', false],
['KR', 'KOR', '410', 'Südkorea', 'Korea (Republic of)', false],
['ZA', 'ZAF', '710', 'Südafrika', 'South Africa', false],
['SD', 'SDN', '729', 'Sudan', 'Sudan', false],
['SR', 'SUR', '740', 'Suriname', 'Suriname', false],
['SJ', 'SJM', '744', 'Svalbard und Jan Mayen', 'Svalbard and Jan Mayen', false],
['SZ', 'SWZ', '748', 'Swasiland', 'Swaziland', false],
['SY', 'SYR', '760', 'Syrien', 'Syrian', false],
['TJ', 'TJK', '762', 'Tadschikistan', 'Tajikistan', false],
['TW', 'TWN', '158', 'Taiwan', 'Taiwan', false],
['TZ', 'TZA', '834', 'Tansania', 'Tanzania', false],
['TH', 'THA', '764', 'Thailand', 'Thailand', false],
['TG', 'TGO', '768', 'Togo', 'Togo', false],
['TK', 'TKL', '772', 'Tokelau', 'Tokelau', false],
['TO', 'TON', '776', 'Tonga', 'Tonga', false],
['TT', 'TTO', '780', 'Trinidad und Tobago', 'Trinidad and Tobago', false],
['TD', 'TCD', '148', 'Tschad', 'Chad', false],
['CZ', 'CZE', '203', 'Tschechien', 'Czech Republic', true],
['TN', 'TUN', '788', 'Tunesien', 'Tunisia', false],
['TR', 'TUR', '792', 'Türkei', 'Turkey', false],
['TM', 'TKM', '795', 'Turkmenistan', 'Turkmenistan', false],
['TC', 'TCA', '796', 'Turks- und Caicosinseln', 'Turks and Caicos Islands', false],
['TV', 'TUV', '798', 'Tuvalu', 'Tuvalu', false],
['UG', 'UGA', '800', 'Uganda', 'Uganda', false],
['UA', 'UKR', '804', 'Ukraine', 'Ukraine', false],
['HU', 'HUN', '348', 'Ungarn', 'Hungary', true],
['UY', 'URY', '858', 'Uruguay', 'Uruguay', false],
['UZ', 'UZB', '860', 'Usbekistan', 'Uzbekistan', false],
['VU', 'VUT', '548', 'Vanuatu', 'Vanuatu', false],
['VA', 'VAT', '336', 'Vatikanstadt', 'Holy See', false],
['VE', 'VEN', '862', 'Venezuela', 'Venezuela', false],
['AE', 'ARE', '784', 'Vereinigte Arabische Emirate', 'United Arab Emirates', false],
['UK', 'GBR', '826', 'Vereinigtes Königreich', 'United Kingdom', false],
['US', 'USA', '840', 'Vereinigte Staaten von Amerika', 'United States of America', false],
['VN', 'VNM', '704', 'Vietnam', 'Viet Nam', false],
['WF', 'WLF', '876', 'Wallis und Futuna', 'Wallis and Futuna', false],
['CX', 'CXR', '162', 'Weihnachtsinsel', 'Christmas Island', false],
['BY', 'BLR', '112', 'Weißrussland', 'Belarus', false],
['EH', 'ESH', '732', 'Westsahara', 'Western Sahara', false],
['CF', 'CAF', '140', 'Zentralafrikanische Republik', 'Central African Republic', false],
['CY', 'CYP', '196', 'Zypern', 'Cyprus', true],
];