2022-04-02 00:55:38 +02:00
|
|
|
<?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.
|
|
|
|
*/
|
2023-05-14 12:11:23 +02:00
|
|
|
final class MDConcCurrencies implements MDImporterConcordanceListInterface {
|
2022-04-02 00:55:38 +02:00
|
|
|
|
2023-05-14 12:11:23 +02:00
|
|
|
private const CURRENCIES_LIST = [
|
2022-04-02 00:55:38 +02:00
|
|
|
"^" => "",
|
|
|
|
"-" => "",
|
2022-09-21 16:34:45 +02:00
|
|
|
"x" => "",
|
2022-09-02 02:10:36 +02:00
|
|
|
"1,00" => "",
|
|
|
|
"5,00" => "",
|
|
|
|
"10,00" => "",
|
|
|
|
"23.117,55" => "",
|
2023-11-14 17:37:09 +01:00
|
|
|
"Belarussischer Rubel" => 'by-BYN',
|
2023-03-23 15:37:55 +01:00
|
|
|
"SFR" => "ch-CHF",
|
2022-04-02 00:55:38 +02:00
|
|
|
"DM" => "de-DM",
|
|
|
|
"DEM" => "de-DM",
|
|
|
|
"Mark" => "de-DM",
|
2022-05-18 15:49:29 +02:00
|
|
|
"de-DM" => "de-DM",
|
|
|
|
"Deutsche Mark" => "de-DM",
|
2023-02-23 12:12:43 +01:00
|
|
|
"RM" => "de-RM",
|
|
|
|
"Reichsmark" => "de-RM",
|
2023-03-18 00:53:05 +01:00
|
|
|
"Reichsmark (Deutsches Reich)" => "de-RM",
|
2023-11-14 17:37:09 +01:00
|
|
|
"French Franc" => "fr-FF",
|
|
|
|
"Forint" => "hu-Ft",
|
|
|
|
"Korona" => "hu-Korona",
|
|
|
|
"Austro-Hungarian krone" => "hu-Korona",
|
2023-11-20 13:55:36 +01:00
|
|
|
"Korona (osztrák-magyar" => "hu-Korona",
|
2023-11-14 17:37:09 +01:00
|
|
|
"Pengő" => "hu-Pengő",
|
|
|
|
"pengő" => "hu-Pengő",
|
|
|
|
"Indonesian Ruphian" => 'id-IDR',
|
2022-04-02 00:55:38 +02:00
|
|
|
"EUR" => "eu-EUR",
|
2023-09-10 04:06:29 +02:00
|
|
|
"euro" => "eu-EUR",
|
2022-04-02 00:55:38 +02:00
|
|
|
"Euro" => "eu-EUR",
|
|
|
|
"EURO" => "eu-EUR",
|
2023-11-24 00:58:39 +01:00
|
|
|
"Євро" => "eu-EUR",
|
2022-05-18 15:49:29 +02:00
|
|
|
"eu-EUR" => "eu-EUR",
|
2022-04-02 00:55:38 +02:00
|
|
|
"€" => "eu-EUR",
|
|
|
|
"Mark (DDR)" => "ddr-Mark",
|
2024-03-12 00:50:58 +01:00
|
|
|
"Mark (DDR" => "ddr-Mark",
|
2023-10-12 23:05:10 +02:00
|
|
|
"DDRMk" => "ddr-Mark",
|
2022-05-18 15:49:29 +02:00
|
|
|
"ddr-Mark" => "ddr-Mark",
|
2023-11-24 00:58:39 +01:00
|
|
|
"Ukrainian hryvnia" => "ua-UAH",
|
|
|
|
"грн" => "ua-UAH",
|
|
|
|
"гривня" => "ua-UAH",
|
2023-12-04 13:24:02 +01:00
|
|
|
"гривні" => "ua-UAH",
|
|
|
|
"грн." => "ua-UAH",
|
|
|
|
"карбованці" => "ua-UAK",
|
2022-10-31 18:06:05 +01:00
|
|
|
"GBP" => "uk-GBP",
|
|
|
|
"uk-GBP" => "uk-GBP",
|
|
|
|
"USD" => "us-USD",
|
2022-11-13 23:01:37 +01:00
|
|
|
"US Dollar" => "us-USD",
|
|
|
|
"US dollar" => "us-USD",
|
2023-12-04 13:24:02 +01:00
|
|
|
"$ USA" => "us-USD",
|
2022-04-02 00:55:38 +02:00
|
|
|
];
|
|
|
|
|
2023-05-14 12:11:23 +02:00
|
|
|
/**
|
|
|
|
* 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])) {
|
2023-11-14 17:37:09 +01:00
|
|
|
if (in_array($input, MDCurrenciesSet::CURRENCIES, true)) {
|
|
|
|
return $input;
|
|
|
|
}
|
2023-05-14 12:11:23 +02:00
|
|
|
throw new MDImporterMissingConcordance("Unknown currency: " . $input);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self::CURRENCIES_LIST[$input];
|
|
|
|
|
|
|
|
}
|
2022-04-02 00:55:38 +02:00
|
|
|
}
|