Compare commits
31 Commits
7f22538085
...
master
Author | SHA1 | Date | |
---|---|---|---|
145b73a379
|
|||
08e58ac709
|
|||
a422a118d7
|
|||
2e6e7e2c53
|
|||
e2192e5828
|
|||
7c865b7271
|
|||
dafe615313
|
|||
924388e4b9
|
|||
f06f7e8670
|
|||
ed4f08c9ac
|
|||
c7e6985915
|
|||
29cfcfccb3
|
|||
ddfdf97e5b
|
|||
61487fb8e6
|
|||
81ab95c047
|
|||
86f6a6c26d
|
|||
da950073e9
|
|||
29879ac02f
|
|||
5ec93ba619
|
|||
1403f75447
|
|||
04c378675c
|
|||
60483d897b
|
|||
a0348b135a
|
|||
45d7c3d455
|
|||
22a30fd52b
|
|||
2e9d0aeff3
|
|||
9fb9e45893
|
|||
4d16367266
|
|||
1b922ce973
|
|||
b01fb98108 | |||
12689d24fa
|
2
l18n
2
l18n
Submodule l18n updated: 6d8b713c07...df66a3a800
14
phpunit.xml
Normal file
14
phpunit.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" backupGlobals="false" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" bootstrap="tests/bootstrap.php" cacheResult="false" colors="true" enforceTimeLimit="true" failOnWarning="true" processIsolation="true" stopOnError="true" stopOnFailure="true" stopOnIncomplete="true" stopOnSkipped="true" stopOnRisky="true" testdox="false" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" cacheDirectory=".phpunit.cache" backupStaticProperties="false" requireCoverageMetadata="false" beStrictAboutCoverageMetadata="false">
|
||||
<testsuites>
|
||||
<testsuite name="tests">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage/>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
</source>
|
||||
</phpunit>
|
@@ -62,18 +62,24 @@ final class MDEventsSet extends MDValueSet {
|
||||
'50', // "vererbt"
|
||||
'51', // is subject of
|
||||
'52', // Emerged
|
||||
'53', // Production of material
|
||||
'54', // Mentioned place
|
||||
'55', // Mentioned time
|
||||
'56', // Received ownership
|
||||
'57', // Transferred ownership
|
||||
'58', // Modified
|
||||
];
|
||||
|
||||
public const EVENTS_PRODUCTION = [1, 7, 9, 10, 19, 20, 26, 27, 28, 38, 39, 48, 52];
|
||||
|
||||
// Array enthält solche Ereignisse, die nach der Herstellung passiert sein müssen
|
||||
public const EVENTS_POST_PRODUCTION = [2, 3, 6, 8, 11, 13, 14, 15, 32, 34, 37, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50];
|
||||
public const EVENTS_POST_PRODUCTION = [2, 3, 6, 8, 11, 13, 14, 15, 32, 34, 37, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 56, 57, 58];
|
||||
|
||||
// Array enthält solche Ereignisse, die vor der Herstellung passiert sein müssen
|
||||
public const EVENTS_PRE_PRODUCTION = [4, 12, 25, 29, 30, 31, 35];
|
||||
public const EVENTS_PRE_PRODUCTION = [4, 12, 25, 29, 30, 31, 35, 53];
|
||||
|
||||
// Array enthält solche Ereignisse, die sich auf Objekte beziehen, die nicht hergestellt wurden
|
||||
public const EVENTS_NO_PRODUCTION = [16, 21, 33, 51];
|
||||
public const EVENTS_NO_PRODUCTION = [16, 21, 33, 51, 54, 55];
|
||||
|
||||
// Array enthält Ereignistypen, die auf Korrespondenzen hinweisen
|
||||
public const EVENTS_CORRESPONDENCE = [11, 13];
|
||||
@@ -81,9 +87,9 @@ final class MDEventsSet extends MDValueSet {
|
||||
/*
|
||||
* Constants for event types without places, times, actors
|
||||
*/
|
||||
public const EVENTS_NO_TIME = [5, 22, 23, 36];
|
||||
public const EVENTS_NO_TIME = [5, 22, 23, 33, 36];
|
||||
public const EVENTS_NO_ACTOR = [21, 22, 24, 36, 52];
|
||||
public const EVENTS_NO_PLACE = [5, 23, 24];
|
||||
public const EVENTS_NO_PLACE = [5, 23, 24, 33];
|
||||
|
||||
/**
|
||||
* Gets a list of the entries in a translated version.
|
||||
|
@@ -39,6 +39,7 @@ final class MDLanguagesSet {
|
||||
'ch',
|
||||
'co',
|
||||
'cr',
|
||||
'crh',
|
||||
'cs',
|
||||
'cu',
|
||||
'cv',
|
||||
@@ -221,10 +222,10 @@ final class MDLanguagesSet {
|
||||
'ba' => 'Bashkir',
|
||||
'be' => 'беларуская мова',
|
||||
'bg' => 'български език',
|
||||
'bh' => 'Bihari',
|
||||
'bh' => 'भोजपुरी',
|
||||
'bi' => 'Bislama',
|
||||
'bm' => 'Bambara',
|
||||
'bn' => 'Bengali',
|
||||
'bn' => 'বাংলা',
|
||||
'bo' => 'བོད་སྐད',
|
||||
'br' => 'Breton',
|
||||
'bs' => 'Bosnian',
|
||||
@@ -233,6 +234,7 @@ final class MDLanguagesSet {
|
||||
'ch' => 'Chamorro',
|
||||
'co' => 'Corsican',
|
||||
'cr' => 'Cree',
|
||||
'crh' => 'Qırımtatar tili',
|
||||
'cs' => 'čeština',
|
||||
'cu' => 'словѣньскъ ѩзыкъ',
|
||||
'cv' => 'Chuvash',
|
||||
@@ -250,7 +252,7 @@ final class MDLanguagesSet {
|
||||
'es' => 'Spanish; Castilian',
|
||||
'et' => 'Estonian',
|
||||
'eu' => 'Basque',
|
||||
'fa' => 'Persian',
|
||||
'fa' => 'فارسی',
|
||||
'ff' => 'Fula; Fulah; Pulaar; Pular',
|
||||
'fi' => 'Finnish',
|
||||
'fj' => 'Fijian',
|
||||
@@ -265,8 +267,8 @@ final class MDLanguagesSet {
|
||||
'gu' => 'Gujarati',
|
||||
'gv' => 'Manx',
|
||||
'ha' => 'Hausa',
|
||||
'he' => 'Hebrew (modern)',
|
||||
'hi' => 'Hindi',
|
||||
'he' => 'עברית',
|
||||
'hi' => 'हिन्दी',
|
||||
'ho' => 'Hiri Motu',
|
||||
'hr' => 'Croatian',
|
||||
'hsb' => 'Hornjoserbšćina',
|
||||
@@ -284,7 +286,7 @@ final class MDLanguagesSet {
|
||||
'is' => 'Icelandic',
|
||||
'it' => 'Italian',
|
||||
'iu' => 'Inuktitut',
|
||||
'ja' => 'Japanese (ja)',
|
||||
'ja' => '日本語',
|
||||
'jv' => 'Javanese (jv)',
|
||||
'ka' => 'Georgian',
|
||||
'kg' => 'Kongo',
|
||||
@@ -292,9 +294,9 @@ final class MDLanguagesSet {
|
||||
'kj' => 'Kwanyama, Kuanyama',
|
||||
'kk' => 'Kazakh',
|
||||
'kl' => 'Kalaallisut, Greenlandic',
|
||||
'km' => 'Khmer',
|
||||
'km' => 'ភាសាខ្មែរ',
|
||||
'kn' => 'ಕನ್ನಡ',
|
||||
'ko' => 'Korean',
|
||||
'ko' => '한국어',
|
||||
'kr' => 'Kanuri',
|
||||
'ks' => 'Kashmiri',
|
||||
'ku' => 'Kurdish',
|
||||
@@ -314,9 +316,9 @@ final class MDLanguagesSet {
|
||||
'mh' => 'Marshallese',
|
||||
'mi' => 'Maori',
|
||||
'mk' => 'Macedonian',
|
||||
'ml' => 'Malayalam',
|
||||
'mn' => 'Mongolian',
|
||||
'mr' => 'Marathi (Mara?hi)',
|
||||
'ml' => 'മലയാളം',
|
||||
'mn' => 'Монгол',
|
||||
'mr' => 'मराठी',
|
||||
'ms' => 'Malay',
|
||||
'mt' => 'Maltese',
|
||||
'my' => 'Burmese',
|
||||
@@ -341,7 +343,7 @@ final class MDLanguagesSet {
|
||||
'pdt' => 'Plautdietsch',
|
||||
'pi' => 'Pali',
|
||||
'pl' => 'Polski',
|
||||
'ps' => 'Pashto, Pushto',
|
||||
'ps' => 'پښتو',
|
||||
'pt' => 'Português',
|
||||
'qu' => 'Quechua',
|
||||
'rm' => 'Romansh',
|
||||
@@ -349,7 +351,7 @@ final class MDLanguagesSet {
|
||||
'ro' => 'Română',
|
||||
'ru' => 'Русский',
|
||||
'rw' => 'Kinyarwanda',
|
||||
'sa' => 'Sanskrit (संस्कृत)',
|
||||
'sa' => 'संस्कृत',
|
||||
'sc' => 'Sardinian',
|
||||
'sd' => 'Sindhi',
|
||||
'se' => 'Northern Sami',
|
||||
@@ -367,8 +369,8 @@ final class MDLanguagesSet {
|
||||
'su' => 'Sundanese',
|
||||
'sv' => 'Swedish',
|
||||
'sw' => 'Swahili',
|
||||
'ta' => 'Tamil',
|
||||
'te' => 'Telugu',
|
||||
'ta' => 'தமிழ்',
|
||||
'te' => 'తెలుగు',
|
||||
'tg' => 'Tajik',
|
||||
'th' => 'ภาษาไทย',
|
||||
'ti' => 'Tigrinya',
|
||||
@@ -386,7 +388,7 @@ final class MDLanguagesSet {
|
||||
'ur' => 'اردو',
|
||||
'uz' => 'Uzbek',
|
||||
've' => 'Venda',
|
||||
'vi' => 'Vietnamese',
|
||||
'vi' => 'Tiếng Việt',
|
||||
'vo' => 'Volapük',
|
||||
'wa' => 'Walloon',
|
||||
'wen' => 'Sorbisch',
|
||||
@@ -427,6 +429,7 @@ final class MDLanguagesSet {
|
||||
'ch' => 'cha', # 'Chamorro',
|
||||
'co' => 'cos', # 'Corsican',
|
||||
'cr' => 'cre', # 'Cree',
|
||||
'crh' => 'crh', # 'Crimean Tatar',
|
||||
'cs' => 'cze', # 'čeština',
|
||||
'cu' => 'chu', # 'словѣньскъ ѩзыкъ',
|
||||
'cv' => 'chv', # 'Chuvash',
|
||||
|
@@ -23,7 +23,7 @@ final class MDRequirementsSet {
|
||||
// Object images need to be at least 500 px wide
|
||||
public const MIN_OBJECT_IMAGE_HEIGHT = 540;
|
||||
|
||||
public const MAX_FILESIZE_PDF = 20000000;
|
||||
public const MAX_FILESIZE_PDF = 40000000;
|
||||
|
||||
public const TIME_EARLIEST_YEAR = -6000000000;
|
||||
public const TIME_EARLIEST_DATE = '0001-01-01';
|
||||
|
@@ -14,6 +14,9 @@ enum MDCountPartsUnit implements MDValueEnumInterface, JsonSerializable, MDMeasu
|
||||
case parts;
|
||||
case sheets;
|
||||
case pages;
|
||||
case double_pages;
|
||||
case standalone_sheets;
|
||||
case written_pages;
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on a string.
|
||||
@@ -28,6 +31,9 @@ enum MDCountPartsUnit implements MDValueEnumInterface, JsonSerializable, MDMeasu
|
||||
'parts' => self::parts,
|
||||
'pages' => self::pages,
|
||||
'sheets' => self::sheets,
|
||||
'double_pages' => self::double_pages,
|
||||
'standalone_sheets' => self::standalone_sheets,
|
||||
'written_pages' => self::written_pages,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown parts counting unit"),
|
||||
};
|
||||
|
||||
@@ -46,6 +52,9 @@ enum MDCountPartsUnit implements MDValueEnumInterface, JsonSerializable, MDMeasu
|
||||
1 => self::parts,
|
||||
2 => self::pages,
|
||||
3 => self::sheets,
|
||||
4 => self::double_pages,
|
||||
5 => self::standalone_sheets,
|
||||
6 => self::written_pages,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown parts counting unit"),
|
||||
};
|
||||
|
||||
@@ -84,6 +93,9 @@ enum MDCountPartsUnit implements MDValueEnumInterface, JsonSerializable, MDMeasu
|
||||
self::parts => 1,
|
||||
self::pages => 2,
|
||||
self::sheets => 3,
|
||||
self::double_pages => 4,
|
||||
self::standalone_sheets => 5,
|
||||
self::written_pages => 6,
|
||||
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||
};
|
||||
|
||||
|
177
src/enums/MDExhibitionContributorRole.php
Normal file
177
src/enums/MDExhibitionContributorRole.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Represents a type of contribution to an exhibition.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Represents a type of contribution to an exhibition.
|
||||
*/
|
||||
enum MDExhibitionContributorRole implements MDValueEnumInterface, JsonSerializable {
|
||||
|
||||
case concept;
|
||||
case curator;
|
||||
case design;
|
||||
case coordinator;
|
||||
case protagonist;
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on a string.
|
||||
*
|
||||
* @param string $input Input to get a value from.
|
||||
*
|
||||
* @return MDExhibitionContributorRole
|
||||
*/
|
||||
public static function fromString(string $input):MDExhibitionContributorRole {
|
||||
|
||||
return match($input) {
|
||||
"concept" => self::concept,
|
||||
"curator" => self::curator,
|
||||
"design" => self::design,
|
||||
"coordinator" => self::coordinator,
|
||||
"protagonist" => self::protagonist,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown exhibition contributor role"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on an integer.
|
||||
*
|
||||
* @param integer $input Input to get a value from.
|
||||
*
|
||||
* @return MDExhibitionContributorRole
|
||||
*/
|
||||
public static function fromInt(int $input):MDExhibitionContributorRole {
|
||||
|
||||
return match($input) {
|
||||
0 => self::concept,
|
||||
1 => self::curator,
|
||||
2 => self::design,
|
||||
3 => self::coordinator,
|
||||
4 => self::protagonist,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown exhibition contributor role"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available names.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function caseNames():array {
|
||||
|
||||
$output = [];
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
$output[] = $case->name;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an unsorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "exhibition_contributor_roles", "exhibition_contributor_roles");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a sorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "exhibition_contributor_roles", "exhibition_contributor_roles");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available names.
|
||||
*
|
||||
* @return array<integer>
|
||||
*/
|
||||
public static function caseInts():array {
|
||||
|
||||
$output = [];
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
$output[] = $case->toInt();
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns integer representation of object record status.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function toInt():int {
|
||||
|
||||
return match($this) {
|
||||
self::concept => 0,
|
||||
self::curator => 1,
|
||||
self::design => 2,
|
||||
self::coordinator => 3,
|
||||
self::protagonist => 4,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns canonical string representation of object record status.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString():string {
|
||||
|
||||
return match($this) {
|
||||
self::concept => 'concept',
|
||||
self::curator => 'curator',
|
||||
self::design => 'design',
|
||||
self::coordinator => 'coordinator',
|
||||
self::protagonist => 'protagonist',
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the current value in translation.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTledName(MDTlLoader $tlLoader):string {
|
||||
|
||||
return $tlLoader->tl("exhibition_contributor_roles", "exhibition_contributor_roles", $this->name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the option to serialize as a string during json_encode().
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize():string {
|
||||
|
||||
return $this->name;
|
||||
|
||||
}
|
||||
}
|
143
src/enums/MDLoanType.php
Normal file
143
src/enums/MDLoanType.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?PHP
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Represents a type of loan.
|
||||
*/
|
||||
enum MDLoanType implements MDValueEnumInterface, JsonSerializable {
|
||||
|
||||
case outgoing;
|
||||
case incoming;
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on a string.
|
||||
*
|
||||
* @param string $input Input to get a value from.
|
||||
*
|
||||
* @return MDLoanType
|
||||
*/
|
||||
public static function fromString(string $input):MDLoanType {
|
||||
|
||||
return match($input) {
|
||||
"outgoing" => self::outgoing,
|
||||
"incoming" => self::incoming,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown loan type"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on an integer.
|
||||
*
|
||||
* @param integer $input Input to get a value from.
|
||||
*
|
||||
* @return MDLoanType
|
||||
*/
|
||||
public static function fromInt(int $input):MDLoanType {
|
||||
|
||||
return match($input) {
|
||||
0 => self::outgoing,
|
||||
1 => self::incoming,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown loan type"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available names.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function caseNames():array {
|
||||
|
||||
$output = [];
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
$output[] = $case->name;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an unsorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "loan_types", "loan_types");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a sorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "loan_types", "loan_types");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available names.
|
||||
*
|
||||
* @return array<integer>
|
||||
*/
|
||||
public static function caseInts():array {
|
||||
|
||||
$output = [];
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
$output[] = $case->toInt();
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns integer representation of object record status.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function toInt():int {
|
||||
|
||||
return match($this) {
|
||||
self::outgoing => 0,
|
||||
self::incoming => 1,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the current value in translation.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTledName(MDTlLoader $tlLoader):string {
|
||||
|
||||
return $tlLoader->tl("loan_types", "loan_types", $this->name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the option to serialize as a string during json_encode().
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize():string {
|
||||
|
||||
return $this->name;
|
||||
|
||||
}
|
||||
}
|
@@ -37,6 +37,18 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
||||
case length_frame;
|
||||
case height_frame;
|
||||
case width_frame;
|
||||
case diameter_frame;
|
||||
case length_min;
|
||||
case length_max;
|
||||
case height_min;
|
||||
case height_max;
|
||||
case width_min;
|
||||
case width_max;
|
||||
case diameter_min;
|
||||
case diameter_max;
|
||||
case length_blade;
|
||||
case height_blade;
|
||||
case width_blade;
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on a string.
|
||||
@@ -69,6 +81,18 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
||||
'length_frame' => self::length_frame,
|
||||
'height_frame' => self::height_frame,
|
||||
'width_frame' => self::width_frame,
|
||||
'length_min' => self::length_min,
|
||||
'length_max' => self::length_max,
|
||||
'height_min' => self::height_min,
|
||||
'height_max' => self::height_max,
|
||||
'width_min' => self::width_min,
|
||||
'width_max' => self::width_max,
|
||||
'diameter_min' => self::diameter_min,
|
||||
'diameter_max' => self::diameter_max,
|
||||
'diameter_frame' => self::diameter_frame,
|
||||
'length_blade' => self::length_blade,
|
||||
'height_blade' => self::height_blade,
|
||||
'width_blade' => self::width_blade,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||
};
|
||||
|
||||
@@ -105,6 +129,18 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
||||
19 => self::length_frame,
|
||||
20 => self::height_frame,
|
||||
21 => self::width_frame,
|
||||
22 => self::length_min,
|
||||
23 => self::length_max,
|
||||
24 => self::height_min,
|
||||
25 => self::height_max,
|
||||
26 => self::width_min,
|
||||
27 => self::width_max,
|
||||
28 => self::diameter_min,
|
||||
29 => self::diameter_max,
|
||||
30 => self::diameter_frame,
|
||||
31 => self::length_blade,
|
||||
32 => self::height_blade,
|
||||
33 => self::width_blade,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||
};
|
||||
|
||||
@@ -161,6 +197,18 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
||||
self::length_frame => self::length,
|
||||
self::height_frame => self::height,
|
||||
self::width_frame => self::width,
|
||||
self::length_min => self::length,
|
||||
self::length_max => self::length,
|
||||
self::height_min => self::height,
|
||||
self::height_max => self::height,
|
||||
self::width_min => self::width,
|
||||
self::width_max => self::width,
|
||||
self::diameter_min => self::diameter,
|
||||
self::diameter_max => self::diameter,
|
||||
self::diameter_frame => self::diameter,
|
||||
self::length_blade => self::length,
|
||||
self::height_blade => self::height,
|
||||
self::width_blade => self::width,
|
||||
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||
};
|
||||
|
||||
@@ -195,6 +243,18 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
||||
self::length_frame => 19,
|
||||
self::height_frame => 20,
|
||||
self::width_frame => 21,
|
||||
self::length_min => 22,
|
||||
self::length_max => 23,
|
||||
self::height_min => 24,
|
||||
self::height_max => 25,
|
||||
self::width_min => 26,
|
||||
self::width_max => 27,
|
||||
self::diameter_min => 28,
|
||||
self::diameter_max => 29,
|
||||
self::diameter_frame => 30,
|
||||
self::length_blade => 31,
|
||||
self::height_blade => 32,
|
||||
self::width_blade => 33,
|
||||
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||
};
|
||||
|
||||
|
@@ -53,37 +53,44 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
|
||||
return match($input) {
|
||||
'allgemein' => self::allgemein, // General link to a good source
|
||||
'AAT-ID',
|
||||
'aat' => self::aat,
|
||||
'ackerbau' => self::ackerbau,
|
||||
'bne' => self::bne,
|
||||
'bnf' => self::bnf,
|
||||
'cona' => self::cona,
|
||||
'edition humboldt digital' => self::editionhumboldtdigital,
|
||||
'gnd' => self::gnd,
|
||||
'GND' => self::gnd,
|
||||
'o-gnd' => self::gnd,
|
||||
'O-GND' => self::gnd,
|
||||
'pnd' => self::gnd,
|
||||
'http://d-nb.info/gnd' => self::gnd,
|
||||
'http://d-nb.info/gnd/' => self::gnd,
|
||||
'd-nb.info' => self::gnd,
|
||||
'd-nb' => self::gnd,
|
||||
'https://portal.dnb.de' => self::gnd,
|
||||
'gnd',
|
||||
'GND',
|
||||
'o-gnd',
|
||||
'O-GND',
|
||||
'GND-Identnummer',
|
||||
'GND-Nummer',
|
||||
'pnd',
|
||||
'http://d-nb.info/', // This is technically wrong, but used in practice...
|
||||
'http://d-nb.info/gnd',
|
||||
'http://d-nb.info/gnd/',
|
||||
'd-nb.info',
|
||||
'd-nb',
|
||||
'https://portal.dnb.de',
|
||||
'https://explore.gnd.network/gnd/' => self::gnd,
|
||||
'grobsystematik' => self::grobsystematik,
|
||||
'iconclass' => self::iconclass,
|
||||
'Iconclass' => self::iconclass,
|
||||
'http://iconclass.org' => self::iconclass,
|
||||
'https://iconclass.org' => self::iconclass,
|
||||
'klbb' => self::klbb,
|
||||
'kl-bb' => self::klbb,
|
||||
'lcsh' => self::lcsh,
|
||||
'loc' => self::loc, // Duplicate?
|
||||
'mindat.org' => self::mindatorg,
|
||||
'moebeltypologie' => self::moebeltypologie,
|
||||
'ndb/adb' => self::ndb_adb,
|
||||
'ndb/adb',
|
||||
'NDB/ADB' => self::ndb_adb,
|
||||
'ndl' => self::ndl,
|
||||
'ndp-ikmk' => self::ndp_ikmk,
|
||||
'ndp-ikmk-persons' => self::ndp_ikmk_persons,
|
||||
'nomisma' => self::nomisma,
|
||||
'nomisma',
|
||||
'nomisma.org' => self::nomisma,
|
||||
'npg' => self::npg,
|
||||
'oberbegriffsdatei' => self::oberbegriffsdatei,
|
||||
@@ -94,11 +101,11 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
'rkd' => self::rkd,
|
||||
'ulan' => self::ulan,
|
||||
'ULAN' => self::ulan,
|
||||
'viaf' => self::viaf,
|
||||
'viaf',
|
||||
'VIAF' => self::viaf,
|
||||
'wikidata' => self::wikidata,
|
||||
'Wikidata' => self::wikidata,
|
||||
'www.wikidata.org' => self::wikidata,
|
||||
'wikidata',
|
||||
'Wikidata',
|
||||
'www.wikidata.org',
|
||||
'WIKIDATA' => self::wikidata,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown norm data repository: '" . $input . "'"),
|
||||
};
|
||||
@@ -624,6 +631,13 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
'https://www.wikidata.org/entity/' => '',
|
||||
'https://www.wikidata.org/w/index.php?search=&search=' => '',
|
||||
]);
|
||||
|
||||
if (str_starts_with($id, 'https://www.wikidata.org/w/index.php?title=')) {
|
||||
$id = str_replace('https://www.wikidata.org/w/index.php?title=', '', $id);
|
||||
if (($endPos = strpos($id, '&')) !== false) {
|
||||
$id = substr($id, 0, $endPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (substr($id, 0, 1) !== 'Q') {
|
||||
|
147
src/enums/MDTranscriptionStatus.php
Normal file
147
src/enums/MDTranscriptionStatus.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Represents a type of check an object may be subject to (completeness, condition, general audit).
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Represents a type of check an object may be subject to (completeness, condition, general audit).
|
||||
*/
|
||||
enum MDTranscriptionStatus implements MDValueEnumInterface, JsonSerializable {
|
||||
|
||||
case incomplete;
|
||||
case machine_generated;
|
||||
case rough_draft;
|
||||
case quality_control_failed;
|
||||
case quality_control_passed;
|
||||
case reviewed;
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on a string.
|
||||
*
|
||||
* @param string $input Input to get a value from.
|
||||
*
|
||||
* @return MDTranscriptionStatus
|
||||
*/
|
||||
public static function fromString(string $input):MDTranscriptionStatus {
|
||||
|
||||
return match($input) {
|
||||
'incomplete' => self::incomplete,
|
||||
'machine_generated' => self::machine_generated,
|
||||
'rough_draft' => self::rough_draft,
|
||||
'quality_control_failed' => self::quality_control_failed,
|
||||
'quality_control_passed' => self::quality_control_passed,
|
||||
'reviewed' => self::reviewed,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown transcript status"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value of this status based on an integer.
|
||||
*
|
||||
* @param integer $input Input to get a value from.
|
||||
*
|
||||
* @return MDTranscriptionStatus
|
||||
*/
|
||||
public static function fromInt(int $input):MDTranscriptionStatus {
|
||||
|
||||
return match($input) {
|
||||
1 => self::incomplete,
|
||||
2 => self::machine_generated,
|
||||
3 => self::rough_draft,
|
||||
4 => self::quality_control_failed,
|
||||
5 => self::quality_control_passed,
|
||||
6 => self::reviewed,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown transcript status"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available names.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function caseNames():array {
|
||||
|
||||
$output = [];
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
$output[] = $case->name;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer representation of the collective (for storage in DB).
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function toInt():int {
|
||||
|
||||
return match($this) {
|
||||
self::incomplete => 1,
|
||||
self::machine_generated => 2,
|
||||
self::rough_draft => 3,
|
||||
self::quality_control_failed => 4,
|
||||
self::quality_control_passed => 5,
|
||||
self::reviewed => 6,
|
||||
# default => throw new MDpageParameterNotFromListException("Unknown transcription type"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an unsorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "transcript_status", "transcript_status");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a sorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "transcript_status", "transcript_status");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the current value in translation.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTledName(MDTlLoader $tlLoader):string {
|
||||
|
||||
return $tlLoader->tl("transcript_status", "transcript_status", $this->name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the option to serialize as a string during json_encode().
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize():string {
|
||||
|
||||
return $this->name;
|
||||
|
||||
}
|
||||
}
|
147
src/enums/MDTranscriptionType.php
Normal file
147
src/enums/MDTranscriptionType.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?PHP
|
||||
/**
|
||||
* Represents a type a transcription was generated towards.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Represents a type a transcription was generated towards.
|
||||
*/
|
||||
enum MDTranscriptionType implements MDValueEnumInterface, JsonSerializable {
|
||||
|
||||
case simple_transcription;
|
||||
case diplomatic_transcription;
|
||||
case critical_edition;
|
||||
case historical_critical_edition;
|
||||
case reading_edition;
|
||||
case constituted_text;
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on a string.
|
||||
*
|
||||
* @param string $input Input to get a value from.
|
||||
*
|
||||
* @return MDTranscriptionType
|
||||
*/
|
||||
public static function fromString(string $input):MDTranscriptionType {
|
||||
|
||||
return match($input) {
|
||||
'simple_transcription' => self::simple_transcription,
|
||||
'diplomatic_transcription' => self::diplomatic_transcription,
|
||||
'critical_edition' => self::critical_edition,
|
||||
'historical_critical_edition' => self::historical_critical_edition,
|
||||
'reading_edition' => self::reading_edition,
|
||||
'constituted_text' => self::constituted_text,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown transcription type"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value of this type based on an integer.
|
||||
*
|
||||
* @param integer $input Input to get a value from.
|
||||
*
|
||||
* @return MDTranscriptionType
|
||||
*/
|
||||
public static function fromInt(int $input):MDTranscriptionType {
|
||||
|
||||
return match($input) {
|
||||
1 => self::simple_transcription,
|
||||
2 => self::diplomatic_transcription,
|
||||
3 => self::critical_edition,
|
||||
4 => self::historical_critical_edition,
|
||||
5 => self::reading_edition,
|
||||
6 => self::constituted_text,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown transcript type"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available names.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function caseNames():array {
|
||||
|
||||
$output = [];
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
$output[] = $case->name;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer representation of the collective (for storage in DB).
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function toInt():int {
|
||||
|
||||
return match($this) {
|
||||
self::simple_transcription => 1,
|
||||
self::diplomatic_transcription => 2,
|
||||
self::critical_edition => 3,
|
||||
self::historical_critical_edition => 4,
|
||||
self::reading_edition => 5,
|
||||
self::constituted_text => 6,
|
||||
# default => throw new MDpageParameterNotFromListException("Unknown TranscriptionTypee"),
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an unsorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "transcript_types", "transcript_types");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a sorted list of the entries in a translated version.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "transcript_types", "transcript_types");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the current value in translation.
|
||||
*
|
||||
* @param MDTlLoader $tlLoader Translation loader.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTledName(MDTlLoader $tlLoader):string {
|
||||
|
||||
return $tlLoader->tl("transcript_types", "transcript_types", $this->name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the option to serialize as a string during json_encode().
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize():string {
|
||||
|
||||
return $this->name;
|
||||
|
||||
}
|
||||
}
|
@@ -21,6 +21,8 @@ final class MDNodaRepositoryTest extends TestCase {
|
||||
*/
|
||||
public function testValidIdsValidate():void {
|
||||
|
||||
self::assertEquals("Q834961", MDNodaRepository::wikidata->validateId("https://www.wikidata.org/w/index.php?title=Q834961&oldid=2256125706"));
|
||||
|
||||
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("http://datos.bne.es/persona/XX5034943"));
|
||||
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("https://datos.bne.es/persona/XX5034943"));
|
||||
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("XX5034943"));
|
||||
|
34
tests/bootstrap.php
Normal file
34
tests/bootstrap.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?PHP
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Autoloader for musdb.
|
||||
*
|
||||
* @param string $className Name of the class to load.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
\spl_autoload_register(function(string $className):void {
|
||||
|
||||
// Try using class map as defined through /scripts/buildClassMap.php
|
||||
|
||||
foreach (array_merge([__DIR__ . '/../tests',
|
||||
__DIR__ . '/../src',
|
||||
__DIR__ . '/../src/enums',
|
||||
__DIR__ . '/../src/classes',
|
||||
__DIR__ . '/../exceptions',
|
||||
__DIR__ . '/../../MD_STD/src',
|
||||
__DIR__ . '/../../MDErrorReporter',
|
||||
__DIR__ . '/../../MDErrorReporter/exceptions',
|
||||
__DIR__ . '/../../MDErrorReporter/exceptions/generic',
|
||||
__DIR__ . '/../../MDErrorReporter/exceptions/updates',
|
||||
]) as $classDir) {
|
||||
|
||||
if (\file_exists("$classDir/$className.php")) {
|
||||
include "$classDir/$className.php";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user