@@ 141-160 (lines=20) @@ | ||
138 | /** |
|
139 | * {@inheritdoc} |
|
140 | */ |
|
141 | public function latest($sourceName, $currencyCode, $rateType = RateType::MEDIAN) |
|
142 | { |
|
143 | /** |
|
144 | * @var RateInterface $rate |
|
145 | */ |
|
146 | foreach ($this->rates as $rate) { |
|
147 | ||
148 | if ( |
|
149 | $rate->getSourceName() === $sourceName |
|
150 | && |
|
151 | $rate->getCurrencyCode() === $currencyCode |
|
152 | && |
|
153 | $rate->getRateType() === $rateType |
|
154 | ) { |
|
155 | return $rate; |
|
156 | } |
|
157 | } |
|
158 | ||
159 | throw new ExchangeRateException(sprintf('Could not fetch latest rate for rate currency code "%s" and rate type "%s" from source "%s".', $currencyCode, $rateType, $sourceName)); |
|
160 | } |
|
161 | ||
162 | /** |
|
163 | * {@inheritdoc} |
@@ 98-117 (lines=20) @@ | ||
95 | /** |
|
96 | * {@inheritdoc} |
|
97 | */ |
|
98 | public function latest($sourceName, $currencyCode, $rateType = RateType::MEDIAN) |
|
99 | { |
|
100 | /** |
|
101 | * @var RateInterface $rate |
|
102 | */ |
|
103 | foreach ($this->rates as $rate) { |
|
104 | ||
105 | if ( |
|
106 | $rate->getSourceName() === $sourceName |
|
107 | && |
|
108 | $rate->getCurrencyCode() === $currencyCode |
|
109 | && |
|
110 | $rate->getRateType() === $rateType |
|
111 | ) { |
|
112 | return $rate; |
|
113 | } |
|
114 | } |
|
115 | ||
116 | throw new ExchangeRateException(sprintf('Could not fetch latest rate for rate currency code "%s" and rate type "%s" from source "%s".', $currencyCode, $rateType, $sourceName)); |
|
117 | } |
|
118 | ||
119 | /** |
|
120 | * {@inheritdoc} |