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 |
||
| 17 | class PersisterRegistry implements ContainerAwareInterface |
||
| 18 | { |
||
| 19 | use ContainerAwareTrait; |
||
| 20 | |||
| 21 | /** @var array */ |
||
| 22 | private $persisters = []; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $index |
||
| 26 | * @param string $type |
||
| 27 | * @param string $persisterId |
||
| 28 | */ |
||
| 29 | public function addPersister($index, $type, $persisterId) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return ObjectPersisterInterface |
||
| 40 | */ |
||
| 41 | View Code Duplication | public function getPersister($index, $type) |
|
| 49 | } |
||
| 50 |