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 Decision extends Entity | ||
| 6 | { | ||
| 7 | /** | ||
| 8 | * @param array $array | ||
| 9 | */ | ||
| 10 | public function __construct(array $array = []) | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Gets the 'slot_id' parameter. | ||
| 17 | * | ||
| 18 | * @return string | ||
| 19 | */ | ||
| 20 | public function getSlotId() | ||
| 24 | |||
| 25 | /** | ||
| 26 | * Gets the 'slot_name' parameter. | ||
| 27 | * | ||
| 28 | * @return string | ||
| 29 | */ | ||
| 30 | public function getSlotName() | ||
| 34 | |||
| 35 | /** | ||
| 36 | * Gets the 'content' parameter. | ||
| 37 | * | ||
| 38 | * @return string | ||
| 39 | */ | ||
| 40 | View Code Duplication | public function getContentList() | |
| 50 | |||
| 51 | /** | ||
| 52 | * Gets the 'policy' parameter. | ||
| 53 | * | ||
| 54 | * @return string | ||
| 55 | */ | ||
| 56 | public function getPolicy() | ||
| 60 | |||
| 61 | /** | ||
| 62 | * Gets the 'rule_id' parameter. | ||
| 63 | * | ||
| 64 | * @return string | ||
| 65 | */ | ||
| 66 | public function getRuleId() | ||
| 70 | |||
| 71 | /** | ||
| 72 | * Gets the 'rule_id' parameter. | ||
| 73 | * | ||
| 74 | * @return string | ||
| 75 | */ | ||
| 76 | public function getRuleName() | ||
| 80 | } | ||
| 81 |