DX: do not loop on possible choices to display action

This commit is contained in:
Julien Fastré 2022-10-06 23:24:38 +02:00
parent f5997e39cd
commit ca67170ad3

View File

@ -74,15 +74,13 @@ class EmergencyFilter implements FilterInterface
public function describeAction($data, $format = 'string'): array
{
foreach (self::CHOICES as $k => $v) {
if ($v === $data['accepted_emergency']) {
$choice = $k;
}
}
return ['Filtered activity by emergency: only %emergency%', [
'%emergency%' => $this->translator->trans($choice),
]];
return [
'Filtered by emergency: only %emergency%', [
'%emergency%' => $this->translator->trans(
$data['accepted_emergency'] ? 'is emergency' : 'is not emergency'
),
],
];
}
public function getTitle(): string