| @@ 114-129 (lines=16) @@ | ||
| 111 | /** |
|
| 112 | * {@inheritdoc} |
|
| 113 | */ |
|
| 114 | public function has($currencyCode, \DateTime $date = null, $rateType = 'default') |
|
| 115 | { |
|
| 116 | if (is_null($date)) { |
|
| 117 | $date = new \DateTime('now'); |
|
| 118 | } |
|
| 119 | ||
| 120 | return array_key_exists(str_replace(array( |
|
| 121 | $currencyCode, |
|
| 122 | $date->format('Y-m-d'), |
|
| 123 | $rateType |
|
| 124 | ), array( |
|
| 125 | '%currency_code%', |
|
| 126 | '%date%', |
|
| 127 | '%rate_type%' |
|
| 128 | ), self::RATE_KEY_FORMAT), $this->rates); |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * {@inheritdoc} |
|
| @@ 134-149 (lines=16) @@ | ||
| 131 | /** |
|
| 132 | * {@inheritdoc} |
|
| 133 | */ |
|
| 134 | public function get($currencyCode, \DateTime $date = null, $rateType = 'default') |
|
| 135 | { |
|
| 136 | if (is_null($date)) { |
|
| 137 | $date = new \DateTime('now'); |
|
| 138 | } |
|
| 139 | ||
| 140 | return $this->rates[str_replace(array( |
|
| 141 | $currencyCode, |
|
| 142 | $date->format('Y-m-d'), |
|
| 143 | $rateType |
|
| 144 | ), array( |
|
| 145 | '%currency_code%', |
|
| 146 | '%date%', |
|
| 147 | '%rate_type%' |
|
| 148 | ), self::RATE_KEY_FORMAT)]; |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * {@inheritdoc} |
|