feat: turn search_trips into the website's travel search
This commit is contained in:
1 parent
bfdedefae3
commit
4ab2714bde
12 files changed
+693
-151
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enum;
|
||||
|
||||
/**
|
||||
* The accommodation type of a TYPO3 hotel record (`type` in the content feed), as the
|
||||
* website's travel search filters it ("Unterkunft"). Values and labels follow the website's
|
||||
* Hotel::$typeLabels.
|
||||
*/
|
||||
enum HotelType: int
|
||||
{
|
||||
case HolidayFlat = 1;
|
||||
case SportsClub = 2;
|
||||
case Apartment = 3;
|
||||
case GuestHouse = 4;
|
||||
case Pension = 5;
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::HolidayFlat => 'Ferienwohnung',
|
||||
self::SportsClub => 'Sportclub',
|
||||
self::Apartment => 'Apartment',
|
||||
self::GuestHouse => 'Gästehaus',
|
||||
self::Pension => 'Pension',
|
||||
};
|
||||
}
|
||||
|
||||
public static function fromLabel(string $label): ?self
|
||||
{
|
||||
foreach (self::cases() as $case) {
|
||||
if (0 === strcasecmp($case->label(), trim($label))) {
|
||||
return $case;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user