Use function getConcordanceTarget() over direct array access

This commit is contained in:
2023-05-14 12:11:23 +02:00
parent c6dca5493d
commit 78fa0c4ce9
18 changed files with 328 additions and 33 deletions

View File

@ -9,9 +9,9 @@ declare(strict_types = 1);
/**
* Provides a list for finding the respective event type for a given time role.
*/
final class MDConcTime {
final class MDConcTime implements MDImporterConcordanceListInterface {
const TIME_ROLES_TO_EVENT_TYPE = [
private const TIME_ROLES_TO_EVENT_TYPE = [
# General / not yet (?) categorized
"Laufzeit" => 24,
@ -40,4 +40,20 @@ final class MDConcTime {
];
/**
* Require a function for getting the concordance target.
*
* @param string $input Input string.
*
* @return integer
*/
public static function getConcordanceTarget(string $input):int {
if (!isset(self::TIME_ROLES_TO_EVENT_TYPE[$input])) {
throw new MDImporterMissingConcordance("Unknown time type: " . $input);
}
return self::TIME_ROLES_TO_EVENT_TYPE[$input];
}
}