public function deserialize($serialized)
{
$data = json_decode($serialized, true);
if ($data === null) {
throw new JsonException('json_encode failed: :message', ['message' => json_last_error_msg()]);
}
if (!is_array($data)) {
throw new JsonException('json serialized data is not a array, maybe it has been corrupted.');
}
if (isset($data['__wrapper__']) && count($data) === 1) {
return $data['__wrapper__'];
} else {
return $data;
}
}