| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0116 |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | 5 | public static function decode($json, $assoc = false, $depth = 512, $option = 0) |
|
| 8 | { |
||
| 9 | 5 | $decodedJson = json_decode($json, $assoc, $depth, $option); |
|
| 10 | |||
| 11 | 5 | $jsonLastError = json_last_error(); |
|
| 12 | 5 | if($jsonLastError != JSON_ERROR_NONE) |
|
| 13 | 5 | { |
|
| 14 | 5 | throw new Exceptions\JsonDecodeError(json_last_error_msg()); |
|
| 15 | } |
||
| 16 | |||
| 17 | return $decodedJson; |
||
| 18 | } |
||
| 19 | |||
| 34 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.