Add function MDSeriesContributorRole::fromInt()

This commit is contained in:
Joshua Ramon Enslin 2024-05-08 00:58:48 +02:00
parent 6772476f9b
commit 493ef9f721
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -59,6 +59,37 @@ enum MDSeriesContributorRole implements MDValueEnumInterface, JsonSerializable {
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDSeriesContributorRole
*/
public static function fromInt(int $input):MDSeriesContributorRole {
return match($input) {
0 => self::author,
1 => self::director,
2 => self::dramaturg,
3 => self::production_designer,
4 => self::costumer,
5 => self::musician,
6 => self::choreographer,
7 => self::make_up_artist,
8 => self::speech_trainer,
9 => self::puppet_maker,
10 => self::technician,
11 => self::inspector,
12 => self::assistant,
13 => self::actor,
14 => self::painter,
15 => self::creator,
default => throw new MDpageParameterNotFromListException("Unknown attendance status"),
};
}
/**
* Lists all available names.
*
@ -85,7 +116,7 @@ enum MDSeriesContributorRole implements MDValueEnumInterface, JsonSerializable {
* @return array<string, string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "attendance_status_set", "attendance_status_set");
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "series_contributor_role", "series_contributor_role");
}
@ -97,7 +128,7 @@ enum MDSeriesContributorRole implements MDValueEnumInterface, JsonSerializable {
* @return array<string, string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array {
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "attendance_status_set", "attendance_status_set");
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "series_contributor_role", "series_contributor_role");
}
@ -157,7 +188,7 @@ enum MDSeriesContributorRole implements MDValueEnumInterface, JsonSerializable {
*/
public function getTledName(MDTlLoader $tlLoader):string {
return $tlLoader->tl("attendance_status_set", "attendance_status_set", $this->name);
return $tlLoader->tl("series_contributor_role", "series_contributor_role", $this->name);
}