Files
MDImporterConcordanceLists/src/MDConcWeights.php

37 lines
828 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?PHP
/**
* Constains lists for categorizing misspelled weight units.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Provides lists for categorizing misspelled sizes.
*/
final class MDConcWeights implements MDImporterConcordanceListInterface {
/**
* Require a function for getting the concordance target.
*
* @param string $input Input string.
*
* @return MDWeightUnit|false
*/
public static function getConcordanceTarget(string $input):MDWeightUnit|false {
return match($input) {
"cm" => false,
"Gramm",
"g",
"G",
"г" => MDWeightUnit::g,
default => throw new MDInvalidWeightUnit("Invalid weight unit " . $input),
};
}
}