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 |
||
| 14 | class IncomingContextFactory |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var BusOperations |
||
| 18 | */ |
||
| 19 | private $busOperations; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var OutgoingOptionsFactory |
||
| 23 | */ |
||
| 24 | private $outgoingOptionsFactory; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param BusOperations $busOperations |
||
| 28 | * @param OutgoingOptionsFactory $outgoingOptionsFactory |
||
| 29 | */ |
||
| 30 | 4 | public function __construct( |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @param TransportReceiveContext $parentContext |
||
| 40 | * |
||
| 41 | * @return IncomingPhysicalMessageContext |
||
| 42 | */ |
||
| 43 | 1 | public function createPhysicalMessageContext(TransportReceiveContext $parentContext) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @param IncomingLogicalMessage $logicalMessage |
||
| 60 | * @param IncomingPhysicalMessageContext $parentContext |
||
| 61 | * |
||
| 62 | * @return IncomingLogicalMessageContext |
||
| 63 | */ |
||
| 64 | 1 | View Code Duplication | public function createLogicalMessageContext( |
| 80 | |||
| 81 | /** |
||
| 82 | * @param MessageHandlerInterface $messageHandler |
||
| 83 | * @param IncomingLogicalMessageContext $parentContext |
||
| 84 | * |
||
| 85 | * @return InvokeHandlerContext |
||
| 86 | */ |
||
| 87 | 1 | View Code Duplication | public function createInvokeHandlerContext( |
| 104 | } |
||
| 105 |