Use function getConcordanceTarget() over direct array access
This commit is contained in:
@ -9,7 +9,7 @@ declare(strict_types = 1);
|
||||
/**
|
||||
* Provides a list for finding the respective event type for a given actor role.
|
||||
*/
|
||||
final class MDConcActor {
|
||||
final class MDConcActor implements MDImporterConcordanceListInterface {
|
||||
|
||||
/**
|
||||
* Substrings of an actor name listed as a key in this array will be replaced
|
||||
@ -22,7 +22,7 @@ final class MDConcActor {
|
||||
"()" => "",
|
||||
];
|
||||
|
||||
const ACTOR_ROLES_TO_EVENT_TYPE = [
|
||||
private const ACTOR_ROLES_TO_EVENT_TYPE = [
|
||||
|
||||
// 1: Created
|
||||
"Aktionskünstler" => 1,
|
||||
@ -866,4 +866,20 @@ final class MDConcActor {
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* 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::ACTOR_ROLES_TO_EVENT_TYPE[$input])) {
|
||||
throw new MDImporterMissingConcordance("Unknown actor role: " . $input);
|
||||
}
|
||||
|
||||
return self::ACTOR_ROLES_TO_EVENT_TYPE[$input];
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user