| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | 18 | protected function decode($str) |
|
| 15 | { |
||
| 16 | 18 | if (empty($str)) { |
|
| 17 | 1 | return []; |
|
| 18 | } |
||
| 19 | |||
| 20 | 17 | if ($str instanceof \Traversable) { |
|
| 21 | 1 | $str = iterator_to_array($str); |
|
| 22 | 1 | } |
|
| 23 | |||
| 24 | 17 | if (! is_array($str)) { |
|
| 25 | 1 | throw new RuntimeException( |
|
| 26 | 'Provided value is not an array or Traversable instance and could not be deserialized' |
||
| 27 | 1 | ); |
|
| 28 | } |
||
| 29 | |||
| 30 | 16 | return $str; |
|
| 31 | } |
||
| 32 | } |
||
| 33 |