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 |
||
| 20 | View Code Duplication | class ValidatorClassNameMethodName extends BaseCoverFishValidator |
|
| 21 | { |
||
| 22 | /** |
||
| 23 | * @return array |
||
| 24 | */ |
||
| 25 | private function execute() |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | public function validate() |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return bool |
||
| 42 | */ |
||
| 43 | public function validateResultKeys() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param CoverFishPHPUnitFile $phpUnitFile |
||
| 53 | * |
||
| 54 | * @return CoverFishMapping |
||
| 55 | */ |
||
| 56 | public function getMapping(CoverFishPHPUnitFile $phpUnitFile) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return string |
||
| 77 | */ |
||
| 78 | public function getValidationInfo() |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return string |
||
| 85 | */ |
||
| 86 | public function getValidationTag() |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @return string |
||
| 93 | */ |
||
| 94 | public function __toString() |
||
| 98 | } |