21.0, 'AT' => 20.0, 'ES' => 21.0, 'CZ' => 21.0, 'PL' => 23.0, 'FR' => 20.0, 'IT' => 22.0, 'DE' => 19.0, ]; public function __construct(private readonly CollectionFactory $countryCollectionFactory) { } public function isEu(string $countryId): bool { return in_array(strtoupper($countryId), self::CODES, true); } public function getRate(string $countryId): float { return self::RATES[strtoupper($countryId)] ?? 19.0; } public function getAppliedRate(string $countryId): float { return self::toAppliedRate($this->getRate($countryId)); } public static function toAppliedRate(float $nominalRate): float { return $nominalRate > 0 ? ($nominalRate / (100 + $nominalRate)) * 100 : 0.0; } public function getOptions(): array { $options = []; $collection = $this->countryCollectionFactory->create() ->addCountryIdFilter(self::CODES); foreach ($collection as $country) { $options[] = ['value' => $country->getCountryId(), 'label' => $country->getName()]; } usort($options, static fn (array $a, array $b): int => strcasecmp((string)$a['label'], (string)$b['label'])); return $options; } }