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 DecideResponse extends Entity |
||
6 | { |
||
7 | /** |
||
8 | * Gets the 'touch_identifier' parameter. |
||
9 | * |
||
10 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
11 | * |
||
12 | * @return string |
||
13 | */ |
||
14 | public function getTouchIdentifier() |
||
19 | |||
20 | private function getLiftWebResponse() { |
||
24 | |||
25 | /** |
||
26 | * Gets the 'identity' parameter. |
||
27 | * |
||
28 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | public function getIdentity() |
||
37 | |||
38 | /** |
||
39 | * Gets the 'identity_source' parameter. |
||
40 | * |
||
41 | * Type of visitor's primary identity information. Specific string (account, email, |
||
42 | * facebook, twitter, tracking, name) or custom identifier type |
||
43 | * |
||
44 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
45 | * |
||
46 | * @return int |
||
47 | */ |
||
48 | public function getIdentityExpiry() |
||
53 | |||
54 | /** |
||
55 | * Gets the 'segments' parameter. |
||
56 | * |
||
57 | * @return Segment[] |
||
58 | */ |
||
59 | View Code Duplication | public function getMatchedSegments() |
|
70 | |||
71 | /** |
||
72 | * gets the 'set_do_not_track' parameter. |
||
73 | * |
||
74 | * Flag to indicate whether the person should not be tracked |
||
75 | * |
||
76 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function getSetDoNotTrack() |
||
84 | |||
85 | /** |
||
86 | * Gets the 'matched_segments' parameter. |
||
87 | * |
||
88 | * @return Segment[] |
||
89 | */ |
||
90 | public function getDecisions() |
||
100 | } |
||
101 |