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 |
||
| 23 | class IndexConfig extends IndexConfigAbstract |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * Indicates if the index should use an alias, allowing an index repopulation to occur |
||
| 27 | * without overwriting the current index. |
||
| 28 | * |
||
| 29 | * @var bool |
||
| 30 | */ |
||
| 31 | private $useAlias = false; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Constructor expects an array as generated by the Container Configuration builder. |
||
| 35 | * |
||
| 36 | * @param string $name |
||
| 37 | * @param TypeConfig[] $types |
||
| 38 | * @param array $config |
||
| 39 | */ |
||
| 40 | 23 | View Code Duplication | public function __construct($name, array $types, array $config) |
| 48 | |||
| 49 | /** |
||
| 50 | * @return bool |
||
| 51 | */ |
||
| 52 | 13 | public function isUseAlias() |
|
| 56 | } |
||
| 57 |