@@ 105-107 (lines=3) @@ | ||
102 | return $this->get($sourceName, $currencyCode, $today, $rateType); |
|
103 | } |
|
104 | ||
105 | if ((int)$today->format('N') >= 6 && $this->has($sourceName, $currencyCode, $lastFriday = new \DateTime('last Friday'), $rateType)) { |
|
106 | return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
107 | } |
|
108 | ||
109 | $message = 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')); |
|
110 | $this->getLogger()->critical($message); |
|
@@ 127-129 (lines=3) @@ | ||
124 | ||
125 | if ((int)$date->format('N') === 6 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P1D')), $rateType)) { |
|
126 | return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
127 | } elseif ((int)$date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) { |
|
128 | return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
129 | } |
|
130 | ||
131 | $message = 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')); |
|
132 | $this->getLogger()->critical($message); |