Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 23 | class CountryCurrencyDao |
||
| 24 | { |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var array[] $country_currency_data |
||
| 28 | */ |
||
| 29 | private $country_currency_data; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var array[] $country_currencies_by_iso_code |
||
| 33 | */ |
||
| 34 | private $country_currencies_by_iso_code; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var array[] $country_currencies_by_currency |
||
| 38 | */ |
||
| 39 | private $country_currencies_by_currency; |
||
| 40 | |||
| 41 | |||
| 42 | /** |
||
| 43 | * @return array[] |
||
| 44 | * @throws EE_Error |
||
| 45 | */ |
||
| 46 | private function initializeCountryCurrencyData() |
||
| 57 | |||
| 58 | |||
| 59 | /** |
||
| 60 | * @param array[] $country_currency_data |
||
| 61 | */ |
||
| 62 | private function parseCountryCurrencyData($country_currency_data) |
||
| 70 | |||
| 71 | |||
| 72 | /** |
||
| 73 | * @param string $CNT_ISO |
||
| 74 | * @return array |
||
| 75 | * @throws EE_Error |
||
| 76 | * @throws InvalidArgumentException |
||
| 77 | */ |
||
| 78 | View Code Duplication | public function getCountryCurrencyByIsoCode($CNT_ISO = '') |
|
| 94 | |||
| 95 | |||
| 96 | /** |
||
| 97 | * @param string $code |
||
| 98 | * @return array |
||
| 99 | * @throws EE_Error |
||
| 100 | * @throws InvalidArgumentException |
||
| 101 | */ |
||
| 102 | View Code Duplication | public function getCountryCurrencyByCurrencyCode($code = '') |
|
| 118 | } |
||
| 119 |