Add concordance lists for colors, forms, sexes

This commit is contained in:
Joshua Ramon Enslin 2023-09-01 15:28:24 +02:00
parent 21babdbd9d
commit 68c7ed06e2
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
3 changed files with 105 additions and 0 deletions

35
src/MDConcColors.php Normal file
View File

@ -0,0 +1,35 @@
<?PHP
/**
* Constains lists for grouping colors.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Constains lists for grouping colors.
*/
final class MDConcColors implements MDImporterConcordanceListInterface {
private const COLORS_LIST = [
'Gelb' => 'yellow',
'Schwarz' => 'black',
];
/**
* 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::COLORS_LIST[$input])) {
throw new MDImporterMissingConcordance("Unknown color: " . $input);
}
return self::COLORS_LIST[$input];
}
}

35
src/MDConcObjectForms.php Normal file
View File

@ -0,0 +1,35 @@
<?PHP
/**
* Constains lists for grouping object forms / shapes.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Constains lists for grouping object forms / shapes.
*/
final class MDConcObjectForms implements MDImporterConcordanceListInterface {
private const FORMS_LIST = [
'Würfel' => 'cube',
'Zylinder' => 'cylinder',
];
/**
* 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::FORMS_LIST[$input])) {
throw new MDImporterMissingConcordance("Unknown form type: " . $input);
}
return self::FORMS_LIST[$input];
}
}

35
src/MDConcSex.php Normal file
View File

@ -0,0 +1,35 @@
<?PHP
/**
* Constains lists for grouping sexes.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Constains lists for grouping sexes.
*/
final class MDConcSex implements MDImporterConcordanceListInterface {
private const SEXES_LIST = [
'Männlich' => 'male',
'diverse' => 'other',
];
/**
* 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::SEXES_LIST[$input])) {
throw new MDImporterMissingConcordance("Unknown sex type: " . $input);
}
return self::SEXES_LIST[$input];
}
}