src/RunOpenCode/ExchangeRate/Manager.php
public function today($sourceName, $currencyCode, $rateType = RateType::MEDIAN)
    {
        $currencyCode = CurrencyCodeUtil::clean($currencyCode);
        $today = new \DateTime('@'.time());

        if ($this->has($sourceName, $currencyCode, $today, $rateType)) {
            return $this->get($sourceName, $currencyCode, $today, $rateType);
        }

        if ((int) $today->format('N') >= 6 && $this->has($sourceName, $currencyCode, $lastFriday = new \DateTime('last Friday'), $rateType)) {
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
        }

        throw new ExchangeRateException(sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for today "%s".', $currencyCode, $rateType, $sourceName, date('Y-m-d')));
    }
public function today($sourceName, $currencyCode, $rateType = RateType::MEDIAN)
    {
        $currencyCode = CurrencyCodeUtil::clean($currencyCode);
        $today = new \DateTime('@'.time());

        if ($this->has($sourceName, $currencyCode, $today, $rateType)) {
            return $this->get($sourceName, $currencyCode, $today, $rateType);
        }

        if ((int) $today->format('N') >= 6 && $this->has($sourceName, $currencyCode, $lastFriday = new \DateTime('last Friday'), $rateType)) {
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
        }

        throw new ExchangeRateException(sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for today "%s".', $currencyCode, $rateType, $sourceName, date('Y-m-d')));
    }
public function today ( $ sourceName , $ currencyCode , $ rateType = RateType :: MEDIAN ) { $ currencyCode = CurrencyCodeUtil :: clean ( $ currencyCode ) ; $ today = new \ DateTime ( '@' . time ( ) ) ; if ( $ this -> has ( $ sourceName , $ currencyCode , $ today , $ rateType ) ) { return $ this -> get ( $ sourceName , $ currencyCode , $ today , $ rateType ) ; } if ( ( int ) $ today -> format ( 'N' ) >= 6 && $ this -> has ( $ sourceName , $ currencyCode , $ lastFriday = new \ DateTime ( 'last Friday' ) , $ rateType ) ) { return $ this -> get ( $ sourceName , $ currencyCode , $ lastFriday , $ rateType ) ; } throw new ExchangeRateException ( sprintf ( 'Rate for currency code "%s" of type "%s" from source "%s" is not available for today "%s".' , $ currencyCode , $ rateType , $ sourceName , date ( 'Y-m-d' ) ) ) ; }
{@inheritdoc}

@throws \RunOpenCode\ExchangeRate\Exception\UnknownCurrencyCodeException
{ @inheritdoc }