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 |
||
5 | class WSCRSHo_FitMemberSearch |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var string $MemberNo |
||
10 | */ |
||
11 | protected $MemberNo = null; |
||
12 | |||
13 | /** |
||
14 | * @var string $FitNo |
||
15 | */ |
||
16 | protected $FitNo = null; |
||
17 | |||
18 | /** |
||
19 | * @var string $FitName |
||
20 | */ |
||
21 | protected $FitName = null; |
||
22 | |||
23 | /** |
||
24 | * @var string $MemberLastName |
||
25 | */ |
||
26 | protected $MemberLastName = null; |
||
27 | |||
28 | /** |
||
29 | * @var string $MemberFirstName |
||
30 | */ |
||
31 | protected $MemberFirstName = null; |
||
32 | |||
33 | /** |
||
34 | * @var boolean $IsActive |
||
35 | */ |
||
36 | protected $IsActive = null; |
||
37 | |||
38 | /** |
||
39 | * @var TSearchRigidity $Rigidity |
||
40 | */ |
||
41 | protected $Rigidity = null; |
||
42 | |||
43 | /** |
||
44 | * @param string $MemberNo |
||
45 | * @param string $FitNo |
||
46 | * @param string $FitName |
||
47 | * @param string $MemberLastName |
||
48 | * @param string $MemberFirstName |
||
49 | * @param boolean $IsActive |
||
50 | * @param TSearchRigidity $Rigidity |
||
51 | */ |
||
52 | View Code Duplication | public function __construct($MemberNo, $FitNo, $FitName, $MemberLastName, $MemberFirstName, $IsActive, $Rigidity) |
|
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getMemberNo() |
||
70 | |||
71 | /** |
||
72 | * @param string $MemberNo |
||
73 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
74 | */ |
||
75 | public function setMemberNo($MemberNo) |
||
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getFitNo() |
||
88 | |||
89 | /** |
||
90 | * @param string $FitNo |
||
91 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
92 | */ |
||
93 | public function setFitNo($FitNo) |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getFitName() |
||
106 | |||
107 | /** |
||
108 | * @param string $FitName |
||
109 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
110 | */ |
||
111 | public function setFitName($FitName) |
||
116 | |||
117 | /** |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getMemberLastName() |
||
124 | |||
125 | /** |
||
126 | * @param string $MemberLastName |
||
127 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
128 | */ |
||
129 | public function setMemberLastName($MemberLastName) |
||
134 | |||
135 | /** |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getMemberFirstName() |
||
142 | |||
143 | /** |
||
144 | * @param string $MemberFirstName |
||
145 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
146 | */ |
||
147 | public function setMemberFirstName($MemberFirstName) |
||
152 | |||
153 | /** |
||
154 | * @return boolean |
||
155 | */ |
||
156 | public function getIsActive() |
||
160 | |||
161 | /** |
||
162 | * @param boolean $IsActive |
||
163 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
164 | */ |
||
165 | public function setIsActive($IsActive) |
||
170 | |||
171 | /** |
||
172 | * @return TSearchRigidity |
||
173 | */ |
||
174 | public function getRigidity() |
||
178 | |||
179 | /** |
||
180 | * @param TSearchRigidity $Rigidity |
||
181 | * @return \Gueststream\PMS\IQWare\API\WSCRSHo_FitMemberSearch |
||
182 | */ |
||
183 | public function setRigidity($Rigidity) |
||
188 | } |
||
189 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.