Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | public static function fromJson($json) { |
||
17 | $stdobj = json_decode($json); |
||
18 | $temp = serialize($stdobj); |
||
19 | |||
20 | // Replacing default object name with ours |
||
21 | $temp = preg_replace('@^O:8:"stdClass":@', 'O:' . strlen(static::class) . ':"' . static::class . '":', $temp); |
||
22 | // Converting default objects to arrays |
||
23 | $temp = preg_replace('@O:8:"stdClass":@', 'a:', $temp); |
||
24 | |||
25 | //Unserialize and walk away like nothing happened |
||
26 | $that = unserialize($temp); |
||
27 | |||
28 | // var_dump($that); |
||
|
|||
29 | |||
30 | return $that; |
||
31 | } |
||
41 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.