@@ 122-124 (lines=3) @@ | ||
119 | return $this->get($sourceName, $currencyCode, $today, $rateType); |
|
120 | } |
|
121 | ||
122 | if ((int) $today->format('N') >= 6 && $this->has($sourceName, $currencyCode, $lastFriday = new \DateTime('last Friday'), $rateType)) { |
|
123 | return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
124 | } |
|
125 | ||
126 | $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')); |
|
127 | $this->getLogger()->critical($message); |
|
@@ 146-148 (lines=3) @@ | ||
143 | ||
144 | if ((int) $date->format('N') === 6 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P1D')), $rateType)) { |
|
145 | return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
146 | } elseif ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) { |
|
147 | return $this->get($sourceName, $currencyCode, $lastFriday, $rateType); |
|
148 | } |
|
149 | ||
150 | $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')); |
|
151 | $this->getLogger()->critical($message); |