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 |
||
24 | View Code Duplication | class MongoDBExecutor extends DoctrineMongoDBExecutor implements ExecutorInterface |
|
25 | { |
||
26 | use ExecutorTrait; |
||
27 | |||
28 | /** |
||
29 | * @var LoaderInterface |
||
30 | */ |
||
31 | private $loader; |
||
32 | |||
33 | /** |
||
34 | * Construct new fixtures loader instance. |
||
35 | * |
||
36 | * @param DocumentManager $manager DocumentManager instance used for persistence. |
||
37 | * @param LoaderInterface $loader |
||
38 | * @param MongoDBPurger $purger |
||
39 | */ |
||
40 | 18 | public function __construct(DocumentManager $manager, LoaderInterface $loader, MongoDBPurger $purger = null) |
|
41 | { |
||
42 | 18 | parent::__construct($manager, $purger); |
|
43 | |||
44 | 18 | $this->loader = $loader; |
|
45 | 18 | } |
|
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 18 | public function execute(array $fixtures, $append = false) |
|
54 | } |
||
55 |