public function ToBytes() { $ret = ProtoBuf_Varint2Bytes($this->fn << 3 | $this->wt); if ($this->wt == ProtoBuf_Field::ProtoBuf_WireType_LengthDelimited) { $ret .= ProtoBuf_Varint2Bytes(strlen($this->data)); } $ret .= $this->data; return $ret; }
public function ToBytes() { $ret = ProtoBuf_Varint2Bytes($this->fn << 3 | $this->wt); if ($this->wt == ProtoBuf_Field::ProtoBuf_WireType_Varint) { $ret .= ProtoBuf_Varint2Bytes($this->data); } elseif ($this->wt == ProtoBuf_Field::ProtoBuf_WireType_64bit) { if ($this->fixed64_is_32bit) { $ret .= ProtoBuf_Fixed2Bytes($this->data, 4); $ret .= ProtoBuf_Fixed2Bytes(0, 4); } else { $ret .= ProtoBuf_Fixed2Bytes($this->data, 8); } } elseif ($this->wt == ProtoBuf_Field::ProtoBuf_WireType_LengthDelimited) { $ret .= ProtoBuf_Varint2Bytes(strlen($this->data)); $ret .= $this->data; } elseif ($this->wt == ProtoBuf_Field::ProtoBuf_WireType_32bit) { $ret .= ProtoBuf_Fixed2Bytes($this->data, 4); } return $ret; }