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 |
||
| 9 | View Code Duplication | class OutgoingPhysicalMessageMutationPipelineStep implements PipelineStepInterface |
|
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var MessageMutatorRegistry |
||
| 13 | */ |
||
| 14 | private $mutatorRegistry; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * IncomingPhysicalMessageMutationPipelineStep constructor. |
||
| 18 | * |
||
| 19 | * @param MessageMutatorRegistry $mutatorRegistry |
||
| 20 | */ |
||
| 21 | 4 | public function __construct(MessageMutatorRegistry $mutatorRegistry) |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @param OutgoingPhysicalMessageContext $context |
||
| 28 | * @param callable $next |
||
| 29 | */ |
||
| 30 | 2 | public function invoke($context, callable $next) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | 1 | public static function getStageContextClass() |
|
| 64 | } |
||
| 65 |