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 CriteriaBuilderCompilerPass extends AbstractCompilerPass  | 
            ||
| 13 | { | 
            ||
| 14 | /**  | 
            ||
| 15 |      * {@inheritdoc} | 
            ||
| 16 | */  | 
            ||
| 17 | 2 | protected function processContext(  | 
            |
| 35 | |||
| 36 | /**  | 
            ||
| 37 | * @param string $contextId  | 
            ||
| 38 | * @param array $builder  | 
            ||
| 39 | * @param ContainerBuilder $container  | 
            ||
| 40 | *  | 
            ||
| 41 | * @return string  | 
            ||
| 42 | *  | 
            ||
| 43 | * @throws InvalidDefinitionException  | 
            ||
| 44 | */  | 
            ||
| 45 | 2 | View Code Duplication | private function processCriteriaBuilder(  | 
            
| 59 | }  | 
            ||
| 60 |