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 place role.
|
||||
*/
|
||||
final class MDConcPlace {
|
||||
final class MDConcPlace implements MDImporterConcordanceListInterface {
|
||||
|
||||
/**
|
||||
* Substrings of an place name listed as a key in this array will be replaced
|
||||
@ -23,7 +23,7 @@ final class MDConcPlace {
|
||||
"Unknown" => "",
|
||||
];
|
||||
|
||||
const PLACE_ROLES_TO_EVENT_TYPE = [
|
||||
private const PLACE_ROLES_TO_EVENT_TYPE = [
|
||||
|
||||
// 22: Related place
|
||||
'' => 22,
|
||||
@ -105,4 +105,20 @@ final class MDConcPlace {
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* 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::PLACE_ROLES_TO_EVENT_TYPE[$input])) {
|
||||
throw new MDImporterMissingConcordance("Unknown place type: " . $input);
|
||||
}
|
||||
|
||||
return self::PLACE_ROLES_TO_EVENT_TYPE[$input];
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user