Add concordance lists for colors, forms, sexes
This commit is contained in:
parent
21babdbd9d
commit
68c7ed06e2
35
src/MDConcColors.php
Normal file
35
src/MDConcColors.php
Normal 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
35
src/MDConcObjectForms.php
Normal 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
35
src/MDConcSex.php
Normal 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];
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user