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  | 
            ||
| 10 | class IndexTemplateConfig implements IndexConfigInterface  | 
            ||
| 11 | { | 
            ||
| 12 | use IndexConfigTrait;  | 
            ||
| 13 | |||
| 14 | /**  | 
            ||
| 15 | * Index name pattern  | 
            ||
| 16 | *  | 
            ||
| 17 | * @var string  | 
            ||
| 18 | */  | 
            ||
| 19 | private $template;  | 
            ||
| 20 | |||
| 21 | /**  | 
            ||
| 22 | * Constructor expects an array as generated by the Container Configuration builder.  | 
            ||
| 23 | *  | 
            ||
| 24 | * @param string $name  | 
            ||
| 25 | * @param TypeConfig[] $types  | 
            ||
| 26 | * @param array $config  | 
            ||
| 27 | */  | 
            ||
| 28 | 9 | View Code Duplication | public function __construct($name, array $types, array $config)  | 
            
| 39 | |||
| 40 | /**  | 
            ||
| 41 | * Gets index name pattern  | 
            ||
| 42 | *  | 
            ||
| 43 | * @return string  | 
            ||
| 44 | */  | 
            ||
| 45 | 7 | public function getTemplate()  | 
            |
| 49 | }  | 
            ||
| 50 |