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 |
||
| 17 | View Code Duplication | final class EnableFiltersSubscriberTest extends TestCase |
|
| 18 | { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var EntityManagerInterface |
||
| 22 | */ |
||
| 23 | private $entityManager; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var EventDispatcherInterface |
||
| 27 | */ |
||
| 28 | private $eventDispatcher; |
||
| 29 | |||
| 30 | |||
| 31 | protected function setUp() |
||
| 37 | |||
| 38 | |||
| 39 | public function testDispatchEvent() |
||
| 50 | |||
| 51 | } |
||
| 52 |