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 |
||
| 7 | trait Html |
||
| 8 | { |
||
| 9 | abstract protected function getSession($name = null); |
||
| 10 | |||
| 11 | View Code Duplication | protected function countElements($element, $index, $parent) |
|
| 23 | |||
| 24 | View Code Duplication | protected function findElement($selector, $locator, $index) |
|
| 36 | } |
||
| 37 |