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 CapturesBase |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Gets the 'touch_identifier' parameter. |
||
| 9 | * |
||
| 10 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
| 11 | * |
||
| 12 | * @return string |
||
| 13 | */ |
||
| 14 | public function getTouchIdentifier() |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Gets the 'identity' parameter. |
||
| 21 | * |
||
| 22 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
| 23 | * |
||
| 24 | * @return string |
||
| 25 | */ |
||
| 26 | public function getIdentity() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Gets the 'identity_source' parameter. |
||
| 33 | * |
||
| 34 | * Type of visitor's primary identity information. Specific string (account, email, |
||
| 35 | * facebook, twitter, tracking, name) or custom identifier type |
||
| 36 | * |
||
| 37 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
| 38 | * |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | public function getIdentitySource() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Gets the 'segments' parameter. |
||
| 48 | * |
||
| 49 | * @return Segment[] |
||
| 50 | */ |
||
| 51 | View Code Duplication | public function getMatchedSegments() |
|
| 61 | |||
| 62 | /** |
||
| 63 | * gets the 'set_do_not_track' parameter. |
||
| 64 | * |
||
| 65 | * Flag to indicate whether the person should not be tracked |
||
| 66 | * |
||
| 67 | * @throws \Acquia\LiftClient\Exception\LiftSdkException |
||
| 68 | * |
||
| 69 | * @return bool |
||
| 70 | */ |
||
| 71 | public function getSetDoNotTrack() |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Gets the 'matched_segments' parameter. |
||
| 78 | * |
||
| 79 | * @return Segment[] |
||
| 80 | */ |
||
| 81 | public function getDecisions() |
||
| 91 | } |
||
| 92 |