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 |
||
12 | final class StringBlockExampleFactory implements ExampleFactoryInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var FactoryInterface |
||
16 | */ |
||
17 | private $factory; |
||
18 | |||
19 | /** |
||
20 | * @var \Faker\Generator |
||
21 | */ |
||
22 | private $faker; |
||
23 | |||
24 | /** |
||
25 | * @var OptionsResolver |
||
26 | */ |
||
27 | private $optionsResolver; |
||
28 | |||
29 | /** |
||
30 | * @param FactoryInterface $factory |
||
31 | */ |
||
32 | public function __construct(FactoryInterface $factory) |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | View Code Duplication | public function create(array $options = []) |
|
65 | } |
||
66 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.