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 |
||
| 15 | final class RouteExampleFactory implements ExampleFactoryInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var FactoryInterface |
||
| 19 | */ |
||
| 20 | private $routeFactory; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var \Faker\Generator |
||
| 24 | */ |
||
| 25 | private $faker; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var OptionsResolver |
||
| 29 | */ |
||
| 30 | private $optionsResolver; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param FactoryInterface $routeFactory |
||
| 34 | * @param RepositoryInterface $staticContentRepository |
||
| 35 | */ |
||
| 36 | public function __construct(FactoryInterface $routeFactory, RepositoryInterface $staticContentRepository) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritdoc} |
||
| 56 | */ |
||
| 57 | View Code Duplication | public function create(array $options = []) |
|
| 68 | } |
||
| 69 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.