Code Duplication    Length = 3-3 lines in 3 locations

src/RunOpenCode/ExchangeRate/Manager.php 3 locations

@@ 132-134 (lines=3) @@
129
            return $this->get($sourceName, $currencyCode, $today, $rateType);
130
        }
131
132
        if ((int) $today->format('N') >= 6 && $this->has($sourceName, $currencyCode, $lastFriday = new \DateTime('last Friday'), $rateType)) {
133
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
134
        }
135
136
        $message = sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for today "%s".', $currencyCode, $rateType, $sourceName, date('Y-m-d'));
137
        $this->getLogger()->critical($message);
@@ 154-156 (lines=3) @@
151
            return $this->get($sourceName, $currencyCode, $date, $rateType);
152
        }
153
154
        if ((int) $date->format('N') === 6 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P1D')), $rateType)) {
155
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
156
        }
157
158
        if ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) {
159
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
@@ 158-160 (lines=3) @@
155
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
156
        }
157
158
        if ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) {
159
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
160
        }
161
162
        $message = sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for historical date "%s".', $currencyCode, $rateType, $sourceName, $date->format('Y-m-d'));
163
        $this->getLogger()->critical($message);