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 |
||
11 | View Code Duplication | class DownloadSeleniumCommand extends Command |
|
12 | { |
||
13 | /** @var SeleniumHandler */ |
||
14 | protected $seleniumHandler; |
||
15 | |||
16 | /** |
||
17 | * @param SeleniumHandler $seleniumHandler |
||
18 | */ |
||
19 | public function __construct(SeleniumHandler $seleniumHandler) |
||
24 | |||
25 | protected function configure() |
||
45 | |||
46 | /** |
||
47 | * @param InputInterface $input |
||
48 | * @param OutputInterface $output |
||
49 | * |
||
50 | * @throws \RuntimeException |
||
51 | */ |
||
52 | protected function execute(InputInterface $input, OutputInterface $output) |
||
59 | |||
60 | private function setDownloaderOptionsFromInput(InputInterface $input) |
||
66 | } |
||
67 |