MDImporterConcordanceLists/src/MDConcCurrencies.php

85 lines
2.3 KiB
PHP

<?PHP
/**
* Constains lists for grouping currencies.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Provides lists for categorizing spelled out currencies.
*/
final class MDConcCurrencies implements MDImporterConcordanceListInterface {
private const CURRENCIES_LIST = [
"^" => "",
"-" => "",
"x" => "",
"1,00" => "",
"5,00" => "",
"10,00" => "",
"23.117,55" => "",
"Belarussischer Rubel" => 'by-BYN',
"SFR" => "ch-CHF",
"DM" => "de-DM",
"DEM" => "de-DM",
"Mark" => "de-DM",
"de-DM" => "de-DM",
"Deutsche Mark" => "de-DM",
"RM" => "de-RM",
"Reichsmark" => "de-RM",
"Reichsmark (Deutsches Reich)" => "de-RM",
"French Franc" => "fr-FF",
"Forint" => "hu-Ft",
"Korona" => "hu-Korona",
"Austro-Hungarian krone" => "hu-Korona",
"Korona (osztrák-magyar" => "hu-Korona",
"Pengő" => "hu-Pengő",
"pengő" => "hu-Pengő",
"Indonesian Ruphian" => 'id-IDR',
"EUR" => "eu-EUR",
"euro" => "eu-EUR",
"Euro" => "eu-EUR",
"EURO" => "eu-EUR",
"Євро" => "eu-EUR",
"eu-EUR" => "eu-EUR",
"" => "eu-EUR",
"Mark (DDR)" => "ddr-Mark",
"Mark (DDR" => "ddr-Mark",
"DDRMk" => "ddr-Mark",
"ddr-Mark" => "ddr-Mark",
"Ukrainian hryvnia" => "ua-UAH",
"грн" => "ua-UAH",
"гривня" => "ua-UAH",
"гривні" => "ua-UAH",
"грн." => "ua-UAH",
"карбованці" => "ua-UAK",
"GBP" => "uk-GBP",
"uk-GBP" => "uk-GBP",
"USD" => "us-USD",
"US Dollar" => "us-USD",
"US dollar" => "us-USD",
"$ USA" => "us-USD",
];
/**
* Require a function for getting the concordance target.
*
* @param string $input Input string.
*
* @return string
*/
public static function getConcordanceTarget(string $input):string {
if (!isset(self::CURRENCIES_LIST[$input])) {
if (in_array($input, MDCurrenciesSet::CURRENCIES, true)) {
return $input;
}
throw new MDImporterMissingConcordance("Unknown currency: " . $input);
}
return self::CURRENCIES_LIST[$input];
}
}