encode(); $this->putString($packet->getBinaryStream()->getBuffer()); } /** * @throws BinaryDataException */ public function getPacket() : Packet{ return PacketPool::getPacket($this->getString()); } /** * Constructs a packet batch from the given list of packets. * * @param Packet ...$packets * * @return PacketBatch */ public static function fromPackets(Packet ...$packets) : self{ $result = new self(); foreach($packets as $packet){ $result->putPacket($packet); } return $result; } }