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 OutgoingContextFactory |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @param OutgoingPublishContext $parentContext |
||
| 21 | * |
||
| 22 | * @return OutgoingLogicalMessageContext |
||
| 23 | */ |
||
| 24 | 1 | View Code Duplication | public function createLogicalMessageContextFromPublishContext( |
| 38 | |||
| 39 | /** |
||
| 40 | * @param AddressTagInterface[] $addressTags |
||
| 41 | * @param OutgoingSendContext $parentContext |
||
| 42 | * |
||
| 43 | * @return OutgoingLogicalMessageContext |
||
| 44 | */ |
||
| 45 | 1 | public function createLogicalMessageContextFromSendContext( |
|
| 60 | |||
| 61 | /** |
||
| 62 | * @param string $replyToAddress |
||
| 63 | * @param OutgoingReplyContext $parentContext |
||
| 64 | * |
||
| 65 | * @return OutgoingLogicalMessageContext |
||
| 66 | */ |
||
| 67 | 1 | View Code Duplication | public function createLogicalMessageContextFromReplyContext($replyToAddress, OutgoingReplyContext $parentContext) |
| 80 | |||
| 81 | /** |
||
| 82 | * @param string $body |
||
| 83 | * @param OutgoingLogicalMessageContext $parentContext |
||
| 84 | * |
||
| 85 | * @return OutgoingPhysicalMessageContext |
||
| 86 | */ |
||
| 87 | 1 | View Code Duplication | public function createPhysicalMessageContext($body, OutgoingLogicalMessageContext $parentContext) |
| 100 | |||
| 101 | /** |
||
| 102 | * @param array $transportOperations |
||
| 103 | * @param PipelineStageContext $parentContext |
||
| 104 | * |
||
| 105 | * @return DispatchContext |
||
| 106 | */ |
||
| 107 | 1 | public function createDispatchContext( |
|
| 113 | } |
||
| 114 |