diff --git a/src/enums/MDCopyrightCollective.php b/src/enums/MDCopyrightCollective.php index d66e5a5..fedbf11 100644 --- a/src/enums/MDCopyrightCollective.php +++ b/src/enums/MDCopyrightCollective.php @@ -9,7 +9,7 @@ declare(strict_types = 1); /** * Represents a type of check an object may be subject to (completeness, condition, general audit). */ -enum MDCopyrightCollective implements JsonSerializable { +enum MDCopyrightCollective implements MDValueEnumInterface, JsonSerializable { case vg_bildkunst; @@ -109,6 +109,53 @@ enum MDCopyrightCollective implements JsonSerializable { } + /** + * Returns the name of the current value in translation. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return string + */ + public function getTledName(MDTlLoader $tlLoader):string { + + return match($this) { + self::vg_bildkunst => 'VG Bildkunst', + }; + + } + + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + + $output = []; + foreach (self::cases() as $case) { + $output[$case->name] = $case->getTledName($tlLoader); + }; + return $output; + + } + + /** + * Gets a sorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + + $output = self::getUnsortedList($tlLoader); + asort($output); + return $output; + + } + /** * Provides the option to serialize as a string during json_encode(). *