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 extends IndexConfigAbstract |
||
11 | { |
||
12 | /** |
||
13 | * Index name pattern |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | private $template; |
||
18 | |||
19 | /** |
||
20 | * Constructor expects an array as generated by the Container Configuration builder. |
||
21 | * |
||
22 | * @param string $name |
||
23 | * @param TypeConfig[] $types |
||
24 | * @param array $config |
||
25 | */ |
||
26 | View Code Duplication | public function __construct($name, array $types, array $config) |
|
37 | |||
38 | /** |
||
39 | * Gets index name pattern |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getTemplate() |
||
47 | } |
||
48 |