label ?? ''; if (null === $service->price) { return $label; } if (0.0 === $service->price) { return sprintf('%s (inkl.)', $label); } if ($service->price < 0) { return sprintf('%s (-%s€ Rabatt)', $label, number_format(abs($service->price), 2, ',', '.')); } return sprintf('%s (€%s)', $label, number_format($service->price, 2, ',', '.')); } /** * @param array $services */ public function formatServiceLabelForServices(string $fallbackLabel, array $services): string { $service = reset($services); if (false === $service) { return $fallbackLabel; } if (!$service instanceof Service) { return $fallbackLabel; } return $this->formatServiceLabel($service); } }