| @@ 65-77 (lines=13) @@ | ||
| 62 | /** |
|
| 63 | * {@inheritdoc} |
|
| 64 | */ |
|
| 65 | public function getRatesExchanges(array $codes, \DateTime $date = null) |
|
| 66 | { |
|
| 67 | $cacheKey = $this->createCacheKey('submarine_nbrb_' . implode('', $codes), $date); |
|
| 68 | ||
| 69 | $result = $this->cache->fetch($cacheKey); |
|
| 70 | if ($result) { |
|
| 71 | return $result; |
|
| 72 | } |
|
| 73 | ||
| 74 | $result = $this->provider->getRatesExchanges($codes, $date); |
|
| 75 | $this->cache->save($cacheKey, $result, $this->lifetime); |
|
| 76 | return $result; |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * {@inheritdoc} |
|
| @@ 82-94 (lines=13) @@ | ||
| 79 | /** |
|
| 80 | * {@inheritdoc} |
|
| 81 | */ |
|
| 82 | public function getRateExchange($code, \DateTime $date = null) |
|
| 83 | { |
|
| 84 | $cacheKey = $this->createCacheKey('submarine_nbrb_' . $code, $date); |
|
| 85 | ||
| 86 | $result = $this->cache->fetch($cacheKey); |
|
| 87 | if ($result) { |
|
| 88 | return $result; |
|
| 89 | } |
|
| 90 | ||
| 91 | $result = $this->provider->getRateExchange($code, $date); |
|
| 92 | $this->cache->save($cacheKey, $result, $this->lifetime); |
|
| 93 | return $result; |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * {@inheritdoc} |
|
| @@ 99-111 (lines=13) @@ | ||
| 96 | /** |
|
| 97 | * {@inheritdoc} |
|
| 98 | */ |
|
| 99 | public function getRatesExchangesDynamic($code, \DateTime $firstDate, \DateTime $lastDate) |
|
| 100 | { |
|
| 101 | $cacheKey = 'submarine_nbrb_dyn_' . $firstDate->format('dmy') . $lastDate->format('dmy'); |
|
| 102 | ||
| 103 | $result = $this->cache->fetch($cacheKey); |
|
| 104 | if ($result) { |
|
| 105 | return $result; |
|
| 106 | } |
|
| 107 | ||
| 108 | $result = $this->provider->getRatesExchangesDynamic($code, $firstDate, $lastDate); |
|
| 109 | $this->cache->save($cacheKey, $result, $this->lifetime); |
|
| 110 | return $result; |
|
| 111 | } |
|
| 112 | ||
| 113 | ||
| 114 | /** |
|