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 | View Code Duplication | class IncomingMessageMutationFeature extends Feature |
|
15 | { |
||
16 | |||
17 | /** |
||
18 | * Method will always be executed and should be used to determine whether to enable or disable the feature, |
||
19 | * configure default settings, configure dependencies, configure prerequisites and register startup tasks. |
||
20 | */ |
||
21 | 1 | public function describe() |
|
25 | |||
26 | /** |
||
27 | * Method is called if all defined conditions are met and the feature is marked as enabled. |
||
28 | * Use this method to configure and initialize all required components for the feature like |
||
29 | * the steps in the pipeline or the instances/factories in the container. |
||
30 | * |
||
31 | * @param Settings $settings |
||
32 | * @param BuilderInterface $builder |
||
33 | * @param PipelineModifications $pipelineModifications |
||
34 | */ |
||
35 | 1 | public function setup(Settings $settings, BuilderInterface $builder, PipelineModifications $pipelineModifications) |
|
56 | } |
||
57 |