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 | 5 | public function execute(InputInterface $input, OutputInterface $output) |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @param InputInterface $input |
||
| 38 | * @param OutputInterface $output |
||
| 39 | * @param string $aliasPackage |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | 4 | private function confirmRemove(InputInterface $input, OutputInterface $output, $aliasPackage) |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @param string $aliasPackage |
||
| 53 | * @return ConfirmationQuestion |
||
| 54 | */ |
||
| 55 | 4 | private function buildQuestion($aliasPackage) |
|
| 64 | } |
||
| 65 |