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 |
||
11 | final class InjectDoctrineRepository implements AnnotationInterface |
||
12 | { |
||
13 | /** |
||
14 | * FQCN of the entity |
||
15 | * @var string |
||
16 | */ |
||
17 | public $value; |
||
18 | |||
19 | /** |
||
20 | * Get the value. |
||
21 | * |
||
22 | * @param ServiceLocatorInterface|null $sm |
||
23 | * @return object |
||
24 | * |
||
25 | * @throws CannotGetValue |
||
26 | */ |
||
27 | 2 | View Code Duplication | public function getValue(ServiceLocatorInterface $sm) |
35 | } |
||
36 |