Add new class MDConcCertainty
This commit is contained in:
43
src/MDConcCertainty.php
Normal file
43
src/MDConcCertainty.php
Normal 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];
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user