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 |
||
12 | class CellCompilerPass extends AbstractChainsCompilerPass |
||
13 | { |
||
14 | /** |
||
15 | * @inheritDoc |
||
16 | */ |
||
17 | 2 | View Code Duplication | protected function processParam( |
36 | |||
37 | /** |
||
38 | * @param string $contextId |
||
39 | * @param array $cellConfig |
||
40 | * @param ContainerBuilder $container |
||
41 | * |
||
42 | * @return Definition |
||
43 | */ |
||
44 | 2 | private function processCell($contextId, array &$cellConfig, ContainerBuilder $container) |
|
64 | |||
65 | /** |
||
66 | * @param ContainerBuilder $container |
||
67 | * @param string $contextId |
||
68 | * @param array $cellConfig |
||
69 | * |
||
70 | * @return Definition |
||
71 | */ |
||
72 | 2 | private function getTransformerDefinition( |
|
90 | |||
91 | /** |
||
92 | * @param $contextId |
||
93 | * @param array $cellConfig |
||
94 | * @param ContainerBuilder $container |
||
95 | * @param Definition $definition |
||
96 | * |
||
97 | * @return Definition |
||
98 | */ |
||
99 | 2 | private function configureDefinition( |
|
117 | } |
||
118 |