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 |
||
18 | View Code Duplication | final class SetConsoleOutputEventSubscriber implements EventSubscriberInterface |
|
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var OutputWriter |
||
23 | */ |
||
24 | private $outputWriter; |
||
25 | |||
26 | |||
27 | 6 | public function __construct(OutputWriter $outputWriter) |
|
31 | |||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | 6 | public static function getSubscribedEvents() |
|
40 | |||
41 | |||
42 | 6 | public function setOutputWriter(ConsoleCommandEvent $event) |
|
51 | |||
52 | |||
53 | /** |
||
54 | * @return bool |
||
55 | */ |
||
56 | 6 | private function isMigrationCommand(Command $command) |
|
60 | |||
61 | } |
||
1 ignored issue
–
show
|
|||
62 |