| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 16 | 
| Code Lines | 8 | 
| Lines | 16 | 
| Ratio | 100 % | 
| Tests | 6 | 
| CRAP Score | 2.0625 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 34 | View Code Duplication | public static function decode($json) | |
| 35 |     { | ||
| 36 | 16 |         set_error_handler(function () use ($json) { | |
| 37 | throw new JsonDecodeException($json); | ||
| 38 | 16 | }); | |
| 39 | |||
| 40 | 16 | $value = json_decode($json, true); | |
| 41 | |||
| 42 | 16 |         if (false === $value) { | |
| 43 | throw new JsonDecodeException($json); | ||
| 44 | } | ||
| 45 | |||
| 46 | 16 | restore_error_handler(); | |
| 47 | |||
| 48 | 16 | return $value; | |
| 49 | } | ||
| 50 | } | ||
| 51 |