Code Duplication    Length = 16-18 lines in 2 locations

src/RunOpenCode/ExchangeRate/Source/NationalBankOfSerbiaDomCrawlerSource.php 2 locations

@@ 77-92 (lines=16) @@
74
        throw new ConfigurationException(sprintf('Source "%s" does not provide currency code "%s" for rate type "%s".', $this->getName(), $currencyCode, $rateType));
75
    }
76
77
    protected function validateRateType($rateType)
78
    {
79
        $knownTypes = array(
80
            'default', // It is actually a middle exchange rate
81
            'foreign_cache_buying',
82
            'foreign_cache_selling',
83
            'foreign_exchange_buying',
84
            'foreign_exchange_selling'
85
        );
86
87
        if (!in_array($rateType, $knownTypes, true)) {
88
            throw new UnknownRateTypeException(sprintf('Unknown rate type "%s" for source "%s", known types are: %s.', $rateType, $this->getName(), implode(', ', $knownTypes)));
89
        }
90
91
        return $this;
92
    }
93
94
    protected function validateCurrencyCode($currencyCode, $rateType)
95
    {
@@ 94-111 (lines=18) @@
91
        return $this;
92
    }
93
94
    protected function validateCurrencyCode($currencyCode, $rateType)
95
    {
96
        $supports = array(
97
            'default' => array(
98
                'EUR'
99
            ),
100
            'foreign_cache_buying',
101
            'foreign_cache_selling',
102
            'foreign_exchange_buying',
103
            'foreign_exchange_selling'
104
        );
105
106
        if (!in_array($currencyCode, $supports[$rateType], true)) {
107
            throw new UnknownCurrencyCodeException(sprintf('Unknown currency code "%s".', $currencyCode));
108
        }
109
110
        return $this;
111
    }
112
113
    /**
114
     * @param \DateTime $date