Use function getConcordanceTarget() over direct array access
This commit is contained in:
@@ -9,9 +9,9 @@ declare(strict_types = 1);
|
||||
/**
|
||||
* Provides lists for categorizing misspelled sizes.
|
||||
*/
|
||||
final class MDConcLengths {
|
||||
final class MDConcLengths implements MDImporterConcordanceListInterface {
|
||||
|
||||
const LENGTHS_LIST = [
|
||||
private const LENGTHS_LIST = [
|
||||
"cn" => "cm",
|
||||
",cm" => "cm",
|
||||
"5cm" => "cm",
|
||||
@@ -21,4 +21,20 @@ final class MDConcLengths {
|
||||
"zoll" => "in",
|
||||
];
|
||||
|
||||
/**
|
||||
* 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::LENGTHS_LIST[$input])) {
|
||||
throw new MDImporterMissingConcordance("Unknown length type: " . $input);
|
||||
}
|
||||
|
||||
return self::LENGTHS_LIST[$input];
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user