Conditions | 8 |
Paths | 8 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 72 |
Changes | 0 |
1 | <?php |
||
44 | private static function jsonLastErrorMsg(){ |
||
45 | if(function_exists('json_last_error_msg')) return json_last_error_msg(); |
||
46 | switch (json_last_error()) { |
||
47 | case JSON_ERROR_NONE: |
||
48 | return ' - No errors'; |
||
49 | break; |
||
|
|||
50 | case JSON_ERROR_DEPTH: |
||
51 | return ' - Maximum stack depth exceeded'; |
||
52 | break; |
||
53 | case JSON_ERROR_STATE_MISMATCH: |
||
54 | return ' - Underflow or the modes mismatch'; |
||
55 | break; |
||
56 | case JSON_ERROR_CTRL_CHAR: |
||
57 | return ' - Unexpected control character found'; |
||
58 | break; |
||
59 | case JSON_ERROR_SYNTAX: |
||
60 | return ' - Syntax error, malformed JSON'; |
||
61 | break; |
||
62 | case JSON_ERROR_UTF8: |
||
63 | return ' - Malformed UTF-8 characters, possibly incorrectly encoded'; |
||
64 | break; |
||
65 | default: |
||
66 | return ' - Unknown error'; |
||
67 | break; |
||
68 | } |
||
69 | } |
||
70 | } |
||
72 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.