Use function getConcordanceTarget() over direct array access
This commit is contained in:
@@ -9,9 +9,9 @@ declare(strict_types = 1);
|
||||
/**
|
||||
* Provides lists for categorizing spelled out currencies.
|
||||
*/
|
||||
final class MDConcCurrencies {
|
||||
final class MDConcCurrencies implements MDImporterConcordanceListInterface {
|
||||
|
||||
const CURRENCIES_LIST = [
|
||||
private const CURRENCIES_LIST = [
|
||||
"^" => "",
|
||||
"-" => "",
|
||||
"x" => "",
|
||||
@@ -48,4 +48,20 @@ final class MDConcCurrencies {
|
||||
"US dollar" => "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])) {
|
||||
throw new MDImporterMissingConcordance("Unknown currency: " . $input);
|
||||
}
|
||||
|
||||
return self::CURRENCIES_LIST[$input];
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user