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 |
||
| 15 | View Code Duplication | class Removing extends Task |
|
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param InputInterface $input |
||
| 19 | * @param OutputInterface $output |
||
| 20 | * @return bool |
||
| 21 | */ |
||
| 22 | 4 | public function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @param InputInterface $input |
||
| 40 | * @param OutputInterface $output |
||
| 41 | * @param string $modulePackage |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | 3 | private function confirmRemove(InputInterface $input, OutputInterface $output, $modulePackage) |
|
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $modulePackage |
||
| 55 | * @return ConfirmationQuestion |
||
| 56 | */ |
||
| 57 | 3 | private function buildQuestion($modulePackage) |
|
| 66 | } |
||
| 67 |