Add MDMeasurementType for listing available measurement types
This commit is contained in:
@ -86,8 +86,9 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
'ndl' => self::ndl,
|
||||
'ndp-ikmk' => self::ndp_ikmk,
|
||||
'ndp-ikmk-persons' => self::ndp_ikmk_persons,
|
||||
'nomisma' => self::nomisma,
|
||||
'npg' => self::npg,
|
||||
'nomisma' => self::nomisma,
|
||||
'nomisma.org' => self::nomisma,
|
||||
'npg' => self::npg,
|
||||
'oberbegriffsdatei' => self::oberbegriffsdatei,
|
||||
'orcid' => self::orcid,
|
||||
'osm' => self::osm,
|
||||
@ -99,6 +100,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
'viaf' => self::viaf,
|
||||
'wikidata' => self::wikidata,
|
||||
'Wikidata' => self::wikidata,
|
||||
'www.wikidata.org' => self::wikidata,
|
||||
'WIKIDATA' => self::wikidata,
|
||||
'WIKIPEDIA' => self::wikidata,
|
||||
'wikipedia' => self::wikipedia,
|
||||
@ -111,6 +113,28 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to get a repository based on a provided link. This function is rather expensive
|
||||
* and should be avoided as much as possible.
|
||||
*
|
||||
* @param string $input Input to get a value from.
|
||||
*
|
||||
* @return MDNodaRepository
|
||||
*/
|
||||
public static function fromUrl(string $input):MDNodaRepository {
|
||||
|
||||
$cases = self::cases();
|
||||
foreach ($cases as $case) {
|
||||
|
||||
$output = $case->validateId($input);
|
||||
if ($output !== false) return $case;
|
||||
|
||||
}
|
||||
|
||||
throw new MDInvalidNodaLink("Failed to get norm data repository based on the provided link");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name as stored in the DB.
|
||||
*
|
||||
|
Reference in New Issue
Block a user