public function readUnknown(Stream $stream, $wire)
    {
        if ($wire === WireFormat::WIRE_VARINT) {
            return $this->readVarint($stream);
        }

        if ($wire === WireFormat::WIRE_LENGTH) {
            return $this->readString($stream);
        }

        if ($wire === WireFormat::WIRE_FIXED32) {
            return $this->readFixed32($stream);
        }

        if ($wire === WireFormat::WIRE_FIXED64) {
            return $this->readFixed64($stream);
        }

        if ($wire === WireFormat::WIRE_GROUP_START || $wire === WireFormat::WIRE_GROUP_END) {
            throw new RuntimeException('Groups are deprecated in Protocol Buffers and unsupported.');
        }

        throw new RuntimeException("Unsupported wire type '$wire' while reading unknown field.");
    }