Use function getConcordanceTarget() over direct array access
This commit is contained in:
@@ -9,11 +9,27 @@ declare(strict_types = 1);
|
||||
/**
|
||||
* Provides lists for categorizing spelled out languages.
|
||||
*/
|
||||
final class MDConcLanguages {
|
||||
final class MDConcLanguages implements MDImporterConcordanceListInterface {
|
||||
|
||||
const LANGUAGES_LIST = [
|
||||
private const LANGUAGES_LIST = [
|
||||
'Deutsch' => 'de',
|
||||
'German' => 'de',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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::LANGUAGES_LIST[$input])) {
|
||||
throw new MDImporterMissingConcordance("Unknown language type: " . $input);
|
||||
}
|
||||
|
||||
return self::LANGUAGES_LIST[$input];
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user