Add new class MDConcCertainty

This commit is contained in:
2025-03-18 01:22:59 +01:00
parent 7765ed2e96
commit fdb47f9f63
3 changed files with 46 additions and 0 deletions

43
src/MDConcCertainty.php Normal file
View File

@ -0,0 +1,43 @@
<?PHP
/**
* Mapping for certainty-expressing fields to certainty in events.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Mapping for certainty-expressing fields to certainty in events.
*/
final class MDConcCertainty implements MDImporterConcordanceListInterface {
private const MAPPING = [
// Uncertain
'fraglich' => false,
// Certain
'sicher' => true,
'by' => true,
];
/**
* Require a function for getting the concordance target.
*
* @param string $input Input string.
*
* @return boolean
*/
public static function getConcordanceTarget(string $input):bool {
if (!isset(self::MAPPING[$input])) {
throw new MDImporterMissingConcordance("Unknown certainty identifier: " . $input);
}
return self::MAPPING[$input];
}
}