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  | 
            ||
| 15 | class GeoCoordinatesProcessManager implements EventListenerInterface  | 
            ||
| 16 | { | 
            ||
| 17 | /**  | 
            ||
| 18 | * @var CommandBusInterface  | 
            ||
| 19 | */  | 
            ||
| 20 | private $commandBus;  | 
            ||
| 21 | |||
| 22 | /**  | 
            ||
| 23 | * @var CultureFeedAddressFactoryInterface  | 
            ||
| 24 | */  | 
            ||
| 25 | private $addressFactory;  | 
            ||
| 26 | |||
| 27 | /**  | 
            ||
| 28 | * @param CommandBusInterface $commandBus  | 
            ||
| 29 | * @param CultureFeedAddressFactoryInterface $addressFactory  | 
            ||
| 30 | */  | 
            ||
| 31 | public function __construct(  | 
            ||
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * @return array  | 
            ||
| 41 | */  | 
            ||
| 42 | private function getEventHandlers()  | 
            ||
| 49 | |||
| 50 | /**  | 
            ||
| 51 | * @param DomainMessage $domainMessage  | 
            ||
| 52 | *  | 
            ||
| 53 | * @uses handleEventImportedFromUDB2  | 
            ||
| 54 | * @uses handleEventUpdatedFromUDB2  | 
            ||
| 55 | */  | 
            ||
| 56 | View Code Duplication | public function handle(DomainMessage $domainMessage)  | 
            |
| 67 | |||
| 68 | /**  | 
            ||
| 69 | * @param EventImportedFromUDB2 $eventImportedFromUDB2  | 
            ||
| 70 | * @throws \CultureFeed_Cdb_ParseException  | 
            ||
| 71 | */  | 
            ||
| 72 | private function handleEventImportedFromUDB2(  | 
            ||
| 81 | |||
| 82 | /**  | 
            ||
| 83 | * @param EventUpdatedFromUDB2 $eventUpdatedFromUDB2  | 
            ||
| 84 | * @throws \CultureFeed_Cdb_ParseException  | 
            ||
| 85 | */  | 
            ||
| 86 | private function handleEventUpdatedFromUDB2(  | 
            ||
| 95 | |||
| 96 | /**  | 
            ||
| 97 | * @param string $cdbXmlNamespaceUri  | 
            ||
| 98 | * @param string $cdbXml  | 
            ||
| 99 | * @param string $eventId  | 
            ||
| 100 | * @throws \CultureFeed_Cdb_ParseException  | 
            ||
| 101 | */  | 
            ||
| 102 | private function dispatchCommand(  | 
            ||
| 134 | }  | 
            ||
| 135 | 
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.