diff --git a/l18n b/l18n index 2504214..7aae0b8 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit 250421445141edcaaede162576b337140696b82a +Subproject commit 7aae0b8edbede8054e6d5e28c3a8a7dcc88734bd diff --git a/src/enums/MDObjectCheckType.php b/src/enums/MDObjectCheckType.php new file mode 100644 index 0000000..8eead1a --- /dev/null +++ b/src/enums/MDObjectCheckType.php @@ -0,0 +1,101 @@ + + */ +declare(strict_types = 1); + +/** + * Represents a type of check an object may be subject to (completeness, condition, general audit). + */ +enum MDObjectCheckType implements MDValueEnumInterface, JsonSerializable { + + case condition_check; + case completeness_check; + case data_correctness_check; + + /** + * Returns a value of this type based on a string. + * + * @param string $input Input to get a value from. + * + * @return MDObjectCheckType + */ + public static function fromString(string $input):MDObjectCheckType { + + return match($input) { + 'condition_check' => self::condition_check, + 'completeness_check' => self::completeness_check, + 'data_correctness_check' => self::data_correctness_check, + default => throw new MDpageParameterNotFromListException("Unknown check type"), + }; + + } + + /** + * Lists all available names. + * + * @return array + */ + 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 + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "object_check_types_set", "object_check_types_set"); + + } + + /** + * 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 { + return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "object_check_types_set", "object_check_types_set"); + + } + + /** + * 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("object_check_types_set", "object_check_types_set", $this->name); + + } + + /** + * Provides the option to serialize as a string during json_encode(). + * + * @return string + */ + public function jsonSerialize():string { + + return $this->name; + + } +}