diff --git a/src/MDConcSourceTypes.php b/src/MDConcSourceTypes.php new file mode 100644 index 0000000..c78f94c --- /dev/null +++ b/src/MDConcSourceTypes.php @@ -0,0 +1,41 @@ + + */ +declare(strict_types = 1); + +/** + * Provides a list for finding the source type for an input. + */ +final class MDConcSourceTypes implements MDImporterConcordanceListInterface { + + private const SOURCE_TYPES = [ + + // Book / default + "buch" => "book", + "literatur" => "book", + + ]; + + /** + * 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::SOURCE_TYPES[$input])) { + return self::SOURCE_TYPES[$input]; + } + if (isset(self::SOURCE_TYPES[strtolower($input)])) { + return self::SOURCE_TYPES[strtolower($input)]; + } + + throw new MDImporterMissingConcordance("Unknown source type: " . $input); + + } +}