@@ 57-72 (lines=16) @@ | ||
54 | ||
55 | } |
|
56 | ||
57 | protected function validateRateType($rateType) |
|
58 | { |
|
59 | $knownTypes = array( |
|
60 | 'default', // It is actually a middle exchange rate |
|
61 | 'foreign_cache_buying', |
|
62 | 'foreign_cache_selling', |
|
63 | 'foreign_exchange_buying', |
|
64 | 'foreign_exchange_selling' |
|
65 | ); |
|
66 | ||
67 | if (!in_array($rateType, $knownTypes)) { |
|
68 | throw new UnknownRateTypeException(sprintf('Unknown rate type "%s" for source "%s", known types are: %s.', $rateType, $this->getName(), implode(', ', $knownTypes))); |
|
69 | } |
|
70 | ||
71 | return $this; |
|
72 | } |
|
73 | ||
74 | protected function validateCurrencyCode($currencyCode, $rateType) |
|
75 | { |
|
@@ 74-91 (lines=18) @@ | ||
71 | return $this; |
|
72 | } |
|
73 | ||
74 | protected function validateCurrencyCode($currencyCode, $rateType) |
|
75 | { |
|
76 | $supports = array( |
|
77 | 'default' => array( |
|
78 | 'EUR' |
|
79 | ), |
|
80 | 'foreign_cache_buying', |
|
81 | 'foreign_cache_selling', |
|
82 | 'foreign_exchange_buying', |
|
83 | 'foreign_exchange_selling' |
|
84 | ); |
|
85 | ||
86 | if (!in_array($currencyCode, $supports[$rateType])) { |
|
87 | throw new UnknownCurrencyCodeException(sprintf('Unknown currency code "%s".', $currencyCode)); |
|
88 | } |
|
89 | ||
90 | return $this; |
|
91 | } |
|
92 | ||
93 | /** |
|
94 | * @param \DateTime $date |