parent
a79b239b27
commit
fb0146cde6
2
l18n
2
l18n
|
@ -1 +1 @@
|
|||
Subproject commit 250421445141edcaaede162576b337140696b82a
|
||||
Subproject commit 7aae0b8edbede8054e6d5e28c3a8a7dcc88734bd
|
101
src/enums/MDObjectCheckType.php
Normal file
101
src/enums/MDObjectCheckType.php
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?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 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<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(), "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<string, string>
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user