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  | 
            ||
| 18 | class URLHandler extends AbstractHandler implements URLHandlerInterface  | 
            ||
| 19 | { | 
            ||
| 20 | /**  | 
            ||
| 21 |      * {@inheritdoc} | 
            ||
| 22 | */  | 
            ||
| 23 | View Code Duplication | public function updateUrl($id, URLUpdateStruct $struct)  | 
            |
| 36 | |||
| 37 | /**  | 
            ||
| 38 |      * {@inheritdoc} | 
            ||
| 39 | */  | 
            ||
| 40 | public function find(URLQuery $query)  | 
            ||
| 48 | |||
| 49 | /**  | 
            ||
| 50 |      * {@inheritdoc} | 
            ||
| 51 | */  | 
            ||
| 52 | View Code Duplication | public function loadById($id)  | 
            |
| 70 | |||
| 71 | /**  | 
            ||
| 72 |      * {@inheritdoc} | 
            ||
| 73 | */  | 
            ||
| 74 | public function loadByUrl($url)  | 
            ||
| 80 | |||
| 81 | /**  | 
            ||
| 82 |      * {@inheritdoc} | 
            ||
| 83 | */  | 
            ||
| 84 | public function findUsages($id)  | 
            ||
| 90 | }  | 
            ||
| 91 |