public function unserialize($raw)
    {
        $prefix = substr($raw, 0, 3);
        $encoded = substr($raw, 3);
        if ($prefix == self::GZIP_SERIAL_PREFIX) {
            if (function_exists('gzdecode')) {
                $serialized = gzdecode($encoded);
            } else if (function_exists('gzinflate')) {
                $serialized = gzinflate(substr($encoded, 10, -8)); // alternate method
            } else {
                throw new \RuntimeException('Unable to unzip serialized data!');
            }
        } else if ($prefix == self::BASE64_SERIAL_PREFIX) {
            $serialized = base64_decode($encoded);
        } else {
            $serialized = $encoded;
        }

        // unserialize and sanity check
        $data = unserialize($serialized);
        if ($data && is_array($data) && count($data) == 2) {
            Http::setOptions($data[0]);
            $this->_options = $data[0];
            $this->_auth = $data[1];
            $this->home = $data[1]->home;
        } else {
            throw new \UnexpectedValueException('Invalid serialized data for PmpSdk');
        }
    }