src/RunOpenCode/ExchangeRate/Processor/UniqueRatesValidator.php
public function process($baseCurrencyCode, RatesConfigurationRegistryInterface $configurations, array $rates)
    {
        $registry = array();

        /**
         * @var RateInterface $rate
         */
        foreach ($rates as $rate) {

            $key = sprintf('%s_%s_%s_%s', $rate->getCurrencyCode(), $rate->getRateType(), $rate->getSourceName(), $rate->getDate()->format('Y-m-d'));

            if (array_key_exists($key, $registry)) {
                throw new ConfigurationException(sprintf('Currency code "%s" of rate type "%s" from source "%s" valid on date "%s" is duplicated.', $rate->getCurrencyCode(), $rate->getRateType(), $rate->getSourceName(), $rate->getDate()->format('Y-m-d')));
            }

            $registry[$key] = $rate->getSourceName();
        }

        return $rates;
    }
public function process($baseCurrencyCode, RatesConfigurationRegistryInterface $configurations, array $rates)
    {
        $registry = array();

        /**
         * @var RateInterface $rate
         */
        foreach ($rates as $rate) {

            $key = sprintf('%s_%s_%s_%s', $rate->getCurrencyCode(), $rate->getRateType(), $rate->getSourceName(), $rate->getDate()->format('Y-m-d'));

            if (array_key_exists($key, $registry)) {
                throw new ConfigurationException(sprintf('Currency code "%s" of rate type "%s" from source "%s" valid on date "%s" is duplicated.', $rate->getCurrencyCode(), $rate->getRateType(), $rate->getSourceName(), $rate->getDate()->format('Y-m-d')));
            }

            $registry[$key] = $rate->getSourceName();
        }

        return $rates;
    }
public function process ( $ baseCurrencyCode , RatesConfigurationRegistryInterface $ configurations , array $ rates ) { $ registry = array ( ) ; /**
         * @var RateInterface $rate
         */ foreach ( $ rates as $ rate ) { $ key = sprintf ( '%s_%s_%s_%s' , $ rate -> getCurrencyCode ( ) , $ rate -> getRateType ( ) , $ rate -> getSourceName ( ) , $ rate -> getDate ( ) -> format ( 'Y-m-d' ) ) ; if ( array_key_exists ( $ key , $ registry ) ) { throw new ConfigurationException ( sprintf ( 'Currency code "%s" of rate type "%s" from source "%s" valid on date "%s" is duplicated.' , $ rate -> getCurrencyCode ( ) , $ rate -> getRateType ( ) , $ rate -> getSourceName ( ) , $ rate -> getDate ( ) -> format ( 'Y-m-d' ) ) ) ; } $ registry [ $ key ] = $ rate -> getSourceName ( ) ; } return $ rates ; }
{@inheritdoc}

@throws ConfigurationException
{ @inheritdoc }