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 | final class Profiler extends ProfilerExtension |
||
24 | { |
||
25 | /** |
||
26 | * Enter $profile. |
||
27 | * |
||
28 | * @param \Twig\Profiler\Profile $profile Profile. |
||
29 | */ |
||
30 | View Code Duplication | public function enter(Profile $profile) |
|
37 | |||
38 | /** |
||
39 | * Leave $profile. |
||
40 | * |
||
41 | * @param \Twig\Profiler\Profile $profile Profile. |
||
42 | */ |
||
43 | View Code Duplication | public function leave(Profile $profile) |
|
50 | } |
||
51 |