| @@ 49-63 (lines=15) @@ | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function has($sourceName, $currencyCode, \DateTime $date = null, $rateType = RateType::MEDIAN) |
|
| 50 | { |
|
| 51 | try { |
|
| 52 | return $this->manager->has($sourceName, $currencyCode, $date, $rateType); |
|
| 53 | } catch (\Exception $e) { |
|
| 54 | $this->logger->error('Unable to determine if rate for {currency_code} of type {rate_type} from source {source} on {date} exists.', [ |
|
| 55 | 'currency_code' => $currencyCode, |
|
| 56 | 'rate_type' => $rateType, |
|
| 57 | 'source' => $sourceName, |
|
| 58 | 'date' => (null === $date) ? date('Y-m-d') : $date->format('Y-m-d'), |
|
| 59 | 'exception' => $e, |
|
| 60 | ]); |
|
| 61 | throw $e; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * {@inheritdoc} |
|
| @@ 68-82 (lines=15) @@ | ||
| 65 | /** |
|
| 66 | * {@inheritdoc} |
|
| 67 | */ |
|
| 68 | public function get($sourceName, $currencyCode, \DateTime $date, $rateType = RateType::MEDIAN) |
|
| 69 | { |
|
| 70 | try { |
|
| 71 | return $this->manager->get($sourceName, $currencyCode, $date, $rateType); |
|
| 72 | } catch (\Exception $e) { |
|
| 73 | $this->logger->error('Unable to fetch rate for {currency_code} of type {rate_type} from source {source} on {date}.', [ |
|
| 74 | 'currency_code' => $currencyCode, |
|
| 75 | 'rate_type' => $rateType, |
|
| 76 | 'source' => $sourceName, |
|
| 77 | 'date' => (null === $date) ? date('Y-m-d') : $date->format('Y-m-d'), |
|
| 78 | 'exception' => $e, |
|
| 79 | ]); |
|
| 80 | throw $e; |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * {@inheritdoc} |
|
| @@ 123-137 (lines=15) @@ | ||
| 120 | /** |
|
| 121 | * {@inheritdoc} |
|
| 122 | */ |
|
| 123 | public function historical($sourceName, $currencyCode, \DateTime $date, $rateType = RateType::MEDIAN) |
|
| 124 | { |
|
| 125 | try { |
|
| 126 | return $this->manager->historical($sourceName, $currencyCode, $date, $rateType); |
|
| 127 | } catch (\Exception $e) { |
|
| 128 | $this->logger->error('Unable to fetch historical rate for {currency_code} of type {rate_type} from source {source} on {date}.', [ |
|
| 129 | 'currency_code' => $currencyCode, |
|
| 130 | 'rate_type' => $rateType, |
|
| 131 | 'source' => $sourceName, |
|
| 132 | 'date' => (null === $date) ? date('Y-m-d') : $date->format('Y-m-d'), |
|
| 133 | 'exception' => $e, |
|
| 134 | ]); |
|
| 135 | throw $e; |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * {@inheritdoc} |
|