wip
This commit is contained in:
+37
-2
@@ -2,14 +2,17 @@
|
||||
|
||||
namespace App\Twig;
|
||||
|
||||
use App\BusProNet\DataProvider\CountryDataProvider;
|
||||
use Twig\Environment;
|
||||
use Twig\Extension\RuntimeExtensionInterface;
|
||||
use Twig\Extra\Intl\IntlExtension;
|
||||
|
||||
class AppRuntime implements RuntimeExtensionInterface
|
||||
{
|
||||
public function __construct(private readonly IntlExtension $intlExtension)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly IntlExtension $intlExtension,
|
||||
private readonly CountryDataProvider $countryDataProvider,
|
||||
) {
|
||||
}
|
||||
|
||||
public function fileIconFilter(Environment $environment, string $mimeType, ?string $classes = 'w-4 h-4'): string
|
||||
@@ -50,6 +53,8 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
|
||||
public function mapStatus(string $status): string
|
||||
{
|
||||
$status = strtoupper($status);
|
||||
|
||||
return match ($status) {
|
||||
'F', 'F/S' => 'Festbuchung',
|
||||
'S' => 'Stornierung',
|
||||
@@ -58,4 +63,34 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
default => '',
|
||||
};
|
||||
}
|
||||
|
||||
public function mapGender(string $gender): string
|
||||
{
|
||||
$gender = strtoupper($gender);
|
||||
|
||||
return match ($gender) {
|
||||
'M' => 'männlich',
|
||||
'F' => 'weiblich',
|
||||
'D' => 'divers',
|
||||
default => '',
|
||||
};
|
||||
}
|
||||
|
||||
public function mapCountry(?string $country): ?string
|
||||
{
|
||||
if (null === $country) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->countryDataProvider->get($country)?->name;
|
||||
}
|
||||
|
||||
public function mapNationality(?string $nationality): ?string
|
||||
{
|
||||
if (null === $nationality) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->countryDataProvider->get($nationality)?->nationality;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user