Conditions | 5 |
Paths | 7 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
48 | public static function unwrap($object) |
||
49 | { |
||
50 | $serialized = (false !== ($capsule = @unserialize(trim($object)))); |
||
51 | |||
52 | if (!$serialized) { |
||
53 | $err = error_get_last(); |
||
54 | throw new \RuntimeException($err['message']); |
||
55 | } |
||
56 | |||
57 | if (true === $capsule->fake) { |
||
58 | if (isset($capsule->object->scalar)) { |
||
59 | $capsule->object = $capsule->object->scalar; |
||
60 | } else { |
||
61 | $capsule->object = (array)$capsule->object; |
||
62 | } |
||
63 | } |
||
64 | |||
65 | if ($capsule->type == 'SimpleXMLElement') { |
||
66 | $capsule->object = simplexml_load_string($capsule->object); |
||
67 | } |
||
68 | |||
69 | return $capsule; |
||
70 | } |
||
71 | } |
||
72 |