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 |
||
| 19 | View Code Duplication | class SearchableFoo implements SearchableInterface |
|
| 20 | { |
||
| 21 | /** |
||
| 22 | * * {@inheritdoc} |
||
| 23 | */ |
||
| 24 | public function amendForm(FormBuilderInterface $form) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * * {@inheritdoc} |
||
| 31 | */ |
||
| 32 | public function getResults(array $words, $searchType = 'AND', $modVars = null) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | public function getErrors() |
||
| 51 | |||
| 52 | private function getBaseResult() |
||
| 63 | } |
||
| 64 |