@@ 120-139 (lines=20) @@ | ||
117 | /** |
|
118 | * {@inheritdoc} |
|
119 | */ |
|
120 | public function has($currencyCode, \DateTime $date = null, $rateType = 'default') |
|
121 | { |
|
122 | if (!$this->rates) { |
|
123 | $this->load(); |
|
124 | } |
|
125 | ||
126 | if (is_null($date)) { |
|
127 | $date = new \DateTime('now'); |
|
128 | } |
|
129 | ||
130 | return array_key_exists(str_replace(array( |
|
131 | $currencyCode, |
|
132 | $date->format('Y-m-d'), |
|
133 | $rateType |
|
134 | ), array( |
|
135 | '%currency_code%', |
|
136 | '%date%', |
|
137 | '%rate_type%' |
|
138 | ), self::RATE_KEY_FORMAT), $this->rates); |
|
139 | } |
|
140 | ||
141 | /** |
|
142 | * {@inheritdoc} |
|
@@ 144-163 (lines=20) @@ | ||
141 | /** |
|
142 | * {@inheritdoc} |
|
143 | */ |
|
144 | public function get($currencyCode, \DateTime $date = null, $rateType = 'default') |
|
145 | { |
|
146 | if (!$this->rates) { |
|
147 | $this->load(); |
|
148 | } |
|
149 | ||
150 | if (is_null($date)) { |
|
151 | $date = new \DateTime('now'); |
|
152 | } |
|
153 | ||
154 | return $this->rates[str_replace(array( |
|
155 | $currencyCode, |
|
156 | $date->format('Y-m-d'), |
|
157 | $rateType |
|
158 | ), array( |
|
159 | '%currency_code%', |
|
160 | '%date%', |
|
161 | '%rate_type%' |
|
162 | ), self::RATE_KEY_FORMAT)]; |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * {@inheritdoc} |