public function unpack()
    {
        // Get fully qualifed name from type url.
        $url_prifix_len = strlen(GPBUtil::TYPE_URL_PREFIX);
        if (substr($this->type_url, 0, $url_prifix_len) !=
                GPBUtil::TYPE_URL_PREFIX) {
            throw new \Exception(
                "Type url needs to be type.googleapis.com/fully-qulified");
        }
        $fully_qualifed_name =
            substr($this->type_url, $url_prifix_len);

        // Create message according to fully qualified name.
        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
        $desc = $pool->getDescriptorByProtoName( ".".$fully_qualifed_name);
        if (is_null($desc)) {
            throw new \Exception("Class ".$fully_qualifed_name
                                     ." hasn't been added to descriptor pool");
        }
        $klass = $desc->getClass();
        $msg = new $klass();

        // Merge data into message.
        $msg->mergeFromString($this->value);
        return $msg;
    }