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 |
||
| 14 | View Code Duplication | class NameQuestion extends Question |
|
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param InputInterface $input |
||
| 18 | * @param OutputInterface $output |
||
| 19 | * @return int |
||
| 20 | */ |
||
| 21 | 5 | public function execute(InputInterface $input, OutputInterface $output) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @return SimpleQuestion |
||
| 29 | */ |
||
| 30 | 5 | private function buildQuestion() |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @return callable |
||
| 40 | */ |
||
| 41 | private function buildValidator() |
||
| 50 | } |
||
| 51 |