2023-10-17 00:35:50 +02:00
|
|
|
|
<?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 {
|
|
|
|
|
|
|
|
|
|
private const WEIGHTS_LIST = [
|
|
|
|
|
"cm" => "", // Default
|
2023-12-03 23:33:59 +01:00
|
|
|
|
"Gramm" => "g",
|
|
|
|
|
"г" => "g",
|
2023-10-17 00:35:50 +02:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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::WEIGHTS_LIST[$input])) {
|
|
|
|
|
throw new MDImporterMissingConcordance("Unknown weight type: " . $input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return self::WEIGHTS_LIST[$input];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|