Use function getConcordanceTarget() over direct array access
This commit is contained in:
@ -9,9 +9,9 @@ declare(strict_types = 1);
|
||||
/**
|
||||
* Provides lists for categorizing spelled out licenses.
|
||||
*/
|
||||
final class MDConcLicenses {
|
||||
final class MDConcLicenses implements MDImporterConcordanceListInterface {
|
||||
|
||||
const LICENSES_LIST = [
|
||||
private const LICENSES_LIST = [
|
||||
"CC 0" => "CC0",
|
||||
"CC_0" => "CC0",
|
||||
"CC0 1.0" => "CC0",
|
||||
@ -44,7 +44,7 @@ final class MDConcLicenses {
|
||||
"CC.BY-NC-SA" => "CC BY-NC-SA",
|
||||
"CC BY-NC-SA 3.0 AT" => "CC BY-NC-SA",
|
||||
"http://creativecommons.org/licenses/by-nc-sa/3.0/" => "CC BY-NC-SA",
|
||||
"https://creativecommons.org/licenses/by-nc-sa/4.0/" => "CC BY-NC-SA",
|
||||
"http://creativecommons.org/licenses/by-nc-sa/4.0/" => "CC BY-NC-SA",
|
||||
"https://creativecommons.org/licenses/by-nc-sa/4.0/" => "CC BY-NC-SA",
|
||||
"Namensnennung - Nicht kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International (CC BY-NC-SA 4.0)" => "CC BY-NC-SA",
|
||||
|
||||
@ -69,4 +69,20 @@ final class MDConcLicenses {
|
||||
'PDM 1.0' => 'Public Domain Mark',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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::LICENSES_LIST[$input])) {
|
||||
throw new MDImporterMissingConcordance("Unknown licence type: " . $input);
|
||||
}
|
||||
|
||||
return self::LICENSES_LIST[$input];
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user