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 |
||
| 10 | final class JmsDoctrineHandler |
||
| 11 | { |
||
| 12 | const TYPE = 'DoctrineAssociation'; |
||
| 13 | |||
| 14 | /** @var ManagerRegistry */ |
||
| 15 | private $registry; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * JmsDoctrineHandler constructor. |
||
| 19 | * |
||
| 20 | * @param ManagerRegistry $registry |
||
| 21 | */ |
||
| 22 | 2 | public function __construct(ManagerRegistry $registry) |
|
| 26 | |||
| 27 | 2 | public function serializeRelation(VisitorInterface $visitor, $relation, array $type, Context $context) |
|
| 39 | |||
| 40 | public function deserializeRelation(VisitorInterface $visitor, $data, array $type, Context $context) |
||
| 45 | |||
| 46 | 1 | View Code Duplication | private function convertEntityToIds($entity) |
| 59 | } |
||
| 60 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.