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 | class OutgoingLogicalMessageMutationPipelineStep implements PipelineStepInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var MessageMutatorRegistry |
||
| 13 | */ |
||
| 14 | private $mutatorRegistry; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param MessageMutatorRegistry $mutatorRegistry |
||
| 18 | */ |
||
| 19 | 5 | public function __construct(MessageMutatorRegistry $mutatorRegistry) |
|
| 23 | |||
| 24 | /** |
||
| 25 | * @param OutgoingLogicalMessageContext $context |
||
| 26 | * @param callable $next |
||
| 27 | */ |
||
| 28 | 3 | View Code Duplication | public function invoke($context, callable $next) |
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | 1 | public static function getStageContextClass() |
|
| 63 | } |
||
| 64 |