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 |
||
33 | View Code Duplication | class Payone_Settings_Data_ConfigFile_PaymentMethod_Creditcard |
|
34 | extends Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract |
||
35 | implements Payone_Settings_Data_ConfigFile_Interface |
||
36 | { |
||
37 | /** @var string */ |
||
38 | protected $key = Payone_Enum_ClearingType::CREDITCARD; |
||
39 | |||
40 | /** @var string */ |
||
41 | protected $cvc2 = ''; |
||
42 | |||
43 | /** @var string */ |
||
44 | protected $hide_cvc = ''; |
||
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | public function getClearingType() |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | public function getKey() |
||
61 | |||
62 | /** |
||
63 | * @param string $cvc2 |
||
64 | */ |
||
65 | public function setCvc2($cvc2) |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getCvc2() |
||
77 | |||
78 | /** |
||
79 | * @param $hide_cvc |
||
80 | */ |
||
81 | public function setHideCvc($hide_cvc) |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getHideCvc() |
||
93 | |||
94 | /** |
||
95 | * @param $value |
||
96 | */ |
||
97 | public function addHideCvc($value) |
||
101 | |||
102 | |||
103 | } |
||
104 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.