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 StopSeleniumCommand 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 | protected function execute(InputInterface $input, OutputInterface $output) |
||
57 | |||
58 | /** |
||
59 | * @param InputInterface $input |
||
60 | */ |
||
61 | private function setStopperOptionsFromInput(InputInterface $input) |
||
67 | } |
||
68 |