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 |
||
| 13 | class WarmUpCommand extends SmokeCommand |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * {@inheritdoc} |
||
| 17 | */ |
||
| 18 | protected function configure() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * {@inheritdoc} |
||
| 33 | */ |
||
| 34 | View Code Duplication | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Initializes the configuration. |
||
| 50 | * |
||
| 51 | * @param $configFile |
||
| 52 | * @param $loadForeign |
||
| 53 | * @param Uri $uri |
||
| 54 | * |
||
| 55 | * @return Configuration |
||
| 56 | */ |
||
| 57 | private function initConfiguration(Uri $uri, Dispatcher $dispatcher) |
||
| 68 | } |
||
| 69 |