| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 55 | public function unpack($packed) |
||
| 56 | { |
||
| 57 | if (!is_string($packed)) { |
||
|
|
|||
| 58 | throw new InvalidArgumentException("packed value should be a string"); |
||
| 59 | } |
||
| 60 | |||
| 61 | $ret = json_decode($packed); |
||
| 62 | |||
| 63 | if (!isset($ret) && json_last_error()) { |
||
| 64 | throw new \UnexpectedValueException("packed value is not a valid JSON string"); |
||
| 65 | } |
||
| 66 | |||
| 67 | return $ret; |
||
| 68 | } |
||
| 70 |