query->get('tax_type'); $year = $request?->query->get('year'); if (!$taxType || !in_array($taxType, Taxe::ALLOWED_STAT_FIELDS, true)) { throw new BadRequestHttpException( sprintf('Invalid tax_type "%s". Allowed: %s', $taxType, implode(', ', Taxe::ALLOWED_STAT_FIELDS)) ); } $yearInt = $year !== null ? (int) $year : null; $data = $this->taxeStatService->getDistribution($taxType, $yearInt); return new RegionDistribution( tax_type: $taxType, year: $yearInt, data: $data, ); } }