|
@@ 129-131 (lines=3) @@
|
| 126 |
|
return $this->get($sourceName, $currencyCode, $today, $rateType); |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
if ((int) $today->format('N') >= 6 && $this->has($sourceName, $currencyCode, $lastFriday = new \DateTime('last Friday'), $rateType)) { |
| 130 |
|
return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
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'))); |
| 134 |
|
} |
|
@@ 149-151 (lines=3) @@
|
| 146 |
|
return $this->get($sourceName, $currencyCode, $date, $rateType); |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
if ((int) $date->format('N') === 6 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P1D')), $rateType)) { |
| 150 |
|
return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
if ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) { |
| 154 |
|
return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
@@ 153-155 (lines=3) @@
|
| 150 |
|
return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
if ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) { |
| 154 |
|
return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
throw new ExchangeRateException(sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for historical date "%s".', $currencyCode, $rateType, $sourceName, $date->format('Y-m-d'))); |
| 158 |
|
} |