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 | View Code Duplication | class Applications extends ArrayCollection implements FromArrayInterface  | 
            |
| 19 | { | 
            ||
| 20 | /**  | 
            ||
| 21 | * @param Application $application  | 
            ||
| 22 | *  | 
            ||
| 23 | * @return $this  | 
            ||
| 24 | */  | 
            ||
| 25 | public function addApplication(Application $application)  | 
            ||
| 31 | |||
| 32 | /**  | 
            ||
| 33 | * @param Application $application  | 
            ||
| 34 | */  | 
            ||
| 35 | public function removeApplication(Application $application)  | 
            ||
| 39 | |||
| 40 | /**  | 
            ||
| 41 |      * {@inheritdoc} | 
            ||
| 42 | */  | 
            ||
| 43 | public static function fromArray(array $data)  | 
            ||
| 53 | }  | 
            ||
| 54 |