*/ declare(strict_types = 1); /** * Represents a method of transportation for objects. */ enum MDTransportMethod implements MDValueEnumInterface, JsonSerializable { case unknown; case car; case ship; /** * Returns a value of this type based on a string. * * @param string $input Input to get a value from. * * @return MDTransportMethod */ public static function fromString(string $input):MDTransportMethod { return match($input) { 'unknown' => self::unknown, 'car' => self::car, 'ship' => self::ship, default => throw new MDpageParameterNotFromListException("Unknown shipment status"), }; } /** * Returns the default status. * * @return MDTransportMethod */ public static function getDefault():MDTransportMethod { return self::unknown; } /** * 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(), "shipment_method_set", "shipment_method_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(), "shipment_method_set", "shipment_method_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("shipment_method_set", "shipment_method_set", $this->name); } /** * Provides the option to serialize as a string during json_encode(). * * @return string */ public function jsonSerialize():string { return $this->name; } }