Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
20 | 4 | public static function encode($value, $option = 0, $depth = 512) |
|
21 | { |
||
22 | 4 | $json = json_encode($value, $option, $depth); |
|
23 | |||
24 | 4 | if($json === false) |
|
25 | 4 | { |
|
26 | 2 | $jsonLastError = json_last_error(); |
|
|
|||
27 | |||
28 | 2 | throw new Exceptions\JsonEncodeError(json_last_error_msg()); |
|
29 | } |
||
30 | |||
31 | 2 | return $json; |
|
32 | } |
||
33 | } |
||
34 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.