Code Duplication    Length = 20-20 lines in 2 locations

src/RunOpenCode/ExchangeRate/Repository/FileRepository.php 2 locations

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