Total Complexity | 2 |
Total Lines | 33 |
Duplicated Lines | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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 |
||
20 | View Code Duplication | final class TimersException extends RuntimeException |
|
|
|||
21 | { |
||
22 | const TIMER_START_MSG = 'An error occurred while attempting to start the timer'; |
||
23 | const TIMER_START_CODE = 32; |
||
24 | |||
25 | const TIMER_STOP_MSG = 'An error occurred while attempting to stop the timer'; |
||
26 | const TIMER_STOP_CODE = 64; |
||
27 | |||
28 | /** |
||
29 | * @param \Exception $e The timer exception |
||
30 | * |
||
31 | * @return TimersException |
||
32 | */ |
||
33 | public static function start(Exception $e) |
||
39 | ); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param \Exception $e The timer exception |
||
44 | * |
||
45 | * @return TimersException |
||
46 | */ |
||
47 | public static function stop(Exception $e) |
||
56 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.