@@ 125-136 (lines=12) @@ | ||
122 | /** |
|
123 | * {@inheritdoc} |
|
124 | */ |
|
125 | public function get($sourceName, $currencyCode, \DateTime $date = null, $rateType = RateType::MEDIAN) |
|
126 | { |
|
127 | if ($date === null) { |
|
128 | $date = new \DateTime('now'); |
|
129 | } |
|
130 | ||
131 | if ($this->has($sourceName, $currencyCode, $date, $rateType)) { |
|
132 | return $this->rates[$this->getRateKey($currencyCode, $date, $rateType, $sourceName)]; |
|
133 | } |
|
134 | ||
135 | throw new ExchangeRateException(sprintf('Could not fetch rate for rate currency code "%s" and rate type "%s" on date "%s".', $currencyCode, $rateType, $date->format('Y-m-d'))); |
|
136 | } |
|
137 | ||
138 | /** |
|
139 | * {@inheritdoc} |
@@ 82-93 (lines=12) @@ | ||
79 | /** |
|
80 | * {@inheritdoc} |
|
81 | */ |
|
82 | public function get($sourceName, $currencyCode, \DateTime $date = null, $rateType = RateType::MEDIAN) |
|
83 | { |
|
84 | if ($date === null) { |
|
85 | $date = new \DateTime('now'); |
|
86 | } |
|
87 | ||
88 | if ($this->has($sourceName, $currencyCode, $date, $rateType)) { |
|
89 | return $this->rates[$this->getRateKey($currencyCode, $date, $rateType, $sourceName)]; |
|
90 | } |
|
91 | ||
92 | throw new ExchangeRateException(sprintf('Could not fetch rate for rate currency code "%s" and rate type "%s" on date "%s".', $currencyCode, $rateType, $date->format('Y-m-d'))); |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * {@inheritdoc} |