Total Complexity | 2 |
Total Lines | 33 |
Duplicated Lines | 100 % |
Changes | 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 FormatterStopException extends RuntimeException |
|
|
|||
21 | { |
||
22 | const MESSAGE_STOP_MSG = 'Error attempting to parse stop message for log'; |
||
23 | const MESSAGE_PARSE_CODE = 1; |
||
24 | |||
25 | const LEVEL_STOP_MSG = 'Error determining log level for stop'; |
||
26 | const LEVEL_STOP_CODE = 2; |
||
27 | |||
28 | /** |
||
29 | * @param \Exception $e The previous exception |
||
30 | * |
||
31 | * @return FormatterStopException |
||
32 | */ |
||
33 | public static function msg(Exception $e) |
||
39 | ); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param \Exception $e The previous exception |
||
44 | * |
||
45 | * @return FormatterStopException |
||
46 | */ |
||
47 | public static function level(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.