Add class MDConcObjectTagRelTypes for mapping strings to object-tag
relation types
This commit is contained in:
parent
f08ea28622
commit
c106318d38
49
src/MDConcObjectTagRelTypes.php
Normal file
49
src/MDConcObjectTagRelTypes.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Constains lists for categorizing links between objects and tags.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Constains lists for categorizing links between objects and tags.
|
||||
*/
|
||||
final class MDConcObjectTagRelTypes implements MDImporterConcordanceListInterface {
|
||||
|
||||
private const RELATION_TYPE_NAMES = [
|
||||
|
||||
'' => 'tag',
|
||||
'tag' => 'tag',
|
||||
|
||||
"motive" => "article",
|
||||
"motiv" => "article",
|
||||
"display" => "display_subject",
|
||||
|
||||
"material" => "material",
|
||||
|
||||
"technique" => "technique",
|
||||
"technik" => "technique",
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* 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::RELATION_TYPE_NAMES[$input])) {
|
||||
return self::RELATION_TYPE_NAMES[$input];
|
||||
}
|
||||
if (isset(self::RELATION_TYPE_NAMES[strtolower($input)])) {
|
||||
return self::RELATION_TYPE_NAMES[strtolower($input)];
|
||||
}
|
||||
|
||||
throw new MDImporterMissingConcordance("Unknown object-tag relationship type: " . $input);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user