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