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() | ||
| 20 | |||
| 21 | private function getLiftWebResponse() | ||
| 27 | |||
| 28 | /** | ||
| 29 | * Gets the 'identity' parameter. | ||
| 30 | * | ||
| 31 | * @throws \Acquia\LiftClient\Exception\LiftSdkException | ||
| 32 | * | ||
| 33 | * @return string | ||
| 34 | */ | ||
| 35 | public function getIdentity() | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Gets the 'identity_source' parameter. | ||
| 44 | * | ||
| 45 | * Type of visitor's primary identity information. Specific string (account, email, | ||
| 46 | * facebook, twitter, tracking, name) or custom identifier type | ||
| 47 | * | ||
| 48 | * @throws \Acquia\LiftClient\Exception\LiftSdkException | ||
| 49 | * | ||
| 50 | * @return int | ||
| 51 | */ | ||
| 52 | public function getIdentityExpiry() | ||
| 58 | |||
| 59 | /** | ||
| 60 | * Gets the 'segments' parameter. | ||
| 61 | * | ||
| 62 | * @return Segment[] | ||
| 63 | */ | ||
| 64 | View Code Duplication | public function getMatchedSegments() | |
| 75 | |||
| 76 | /** | ||
| 77 | * gets the 'set_do_not_track' parameter. | ||
| 78 | * | ||
| 79 | * Flag to indicate whether the person should not be tracked | ||
| 80 | * | ||
| 81 | * @throws \Acquia\LiftClient\Exception\LiftSdkException | ||
| 82 | * | ||
| 83 | * @return bool | ||
| 84 | */ | ||
| 85 | public function getSetDoNotTrack() | ||
| 89 | |||
| 90 | /** | ||
| 91 | * Gets the 'matched_segments' parameter. | ||
| 92 | * | ||
| 93 | * @return Segment[] | ||
| 94 | */ | ||
| 95 | public function getDecisions() | ||
| 105 | } | ||
| 106 |