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 |
||
| 10 | class IncomingLogicalMessageMutationPipelineStep implements PipelineStepInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var MessageMutatorRegistry |
||
| 14 | */ |
||
| 15 | private $mutatorRegistry; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var IncomingLogicalMessageFactory |
||
| 19 | */ |
||
| 20 | private $messageFactory; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param MessageMutatorRegistry $mutatorRegistry |
||
| 24 | * @param IncomingLogicalMessageFactory $messageFactory |
||
| 25 | */ |
||
| 26 | 5 | public function __construct(MessageMutatorRegistry $mutatorRegistry, IncomingLogicalMessageFactory $messageFactory) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @param IncomingLogicalMessageContext $context |
||
| 34 | * @param callable $next |
||
| 35 | */ |
||
| 36 | 3 | View Code Duplication | public function invoke($context, callable $next) |
| 63 | |||
| 64 | /** |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | 1 | public static function getStageContextClass() |
|
| 71 | } |