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 |
||
| 21 | View Code Duplication | class ValidatorClassNameMethodAccess extends BaseCoverFishValidator |
|
| 22 | { |
||
| 23 | /** |
||
| 24 | * @return array |
||
| 25 | */ |
||
| 26 | private function execute() |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @return bool |
||
| 35 | */ |
||
| 36 | public function validate() |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | public function validateResultKeys() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param CoverFishPHPUnitFile $phpUnitFile |
||
| 54 | * |
||
| 55 | * @return CoverFishMapping |
||
| 56 | */ |
||
| 57 | public function getMapping(CoverFishPHPUnitFile $phpUnitFile) |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return string |
||
| 78 | */ |
||
| 79 | public function getValidationInfo() |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @return string |
||
| 86 | */ |
||
| 87 | public function getValidationTag() |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @return string |
||
| 94 | */ |
||
| 95 | public function __toString() |
||
| 99 | } |