Update concordance lists for new measurements implementation
This commit is contained in:
@@ -10,27 +10,25 @@ declare(strict_types = 1);
|
||||
* Provides lists for categorizing misspelled sizes.
|
||||
*/
|
||||
final class MDConcWeights implements MDImporterConcordanceListInterface {
|
||||
|
||||
private const WEIGHTS_LIST = [
|
||||
"cm" => "", // Default
|
||||
"Gramm" => "g",
|
||||
"г" => "g",
|
||||
];
|
||||
|
||||
/**
|
||||
* Require a function for getting the concordance target.
|
||||
*
|
||||
* @param string $input Input string.
|
||||
*
|
||||
* @return string
|
||||
* @return MDWeightUnit|false
|
||||
*/
|
||||
public static function getConcordanceTarget(string $input):string {
|
||||
public static function getConcordanceTarget(string $input):MDWeightUnit|false {
|
||||
|
||||
if (!isset(self::WEIGHTS_LIST[$input])) {
|
||||
throw new MDImporterMissingConcordance("Unknown weight type: " . $input);
|
||||
}
|
||||
return match($input) {
|
||||
|
||||
return self::WEIGHTS_LIST[$input];
|
||||
"cm" => false,
|
||||
|
||||
"Gramm",
|
||||
"г" => MDWeightUnit::g,
|
||||
|
||||
default => throw new MDInvalidWeightUnit("Invalid weight unit " . $input),
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user