Files
2025-08-02 16:30:27 +02:00

30 lines
716 B
PHP

<?php
namespace KupShop\GraphQLBundle\ApiPublic\Util;
use KupShop\GraphQLBundle\ApiPublic\Types\ShopCurrency;
use KupShop\KupShopBundle\Context\CurrencyContext;
class CurrencyUtil
{
private $currencyContext;
public function __construct(CurrencyContext $currencyContext)
{
$this->currencyContext = $currencyContext;
}
public function getCurrencies(): array
{
$currencies = $this->currencyContext->getSupported();
$active = $this->currencyContext->getActive();
$result = [];
foreach ($currencies as $currency) {
$result[] = new ShopCurrency($currency, $active->getId() == $currency->getId());
}
return $result;
}
}