PacketBatch: get rid of putPacket()

This commit is contained in:
Dylan K. Taylor
2020-07-22 15:24:08 +01:00
parent 2fcee432c1
commit 798efc370c
2 changed files with 6 additions and 16 deletions

View File

@@ -37,11 +37,6 @@ class PacketBatch{
$this->serializer = new PacketSerializer($buffer ?? "");
}
public function putPacket(Packet $packet) : void{
$packet->encode();
$this->serializer->putString($packet->getSerializer()->getBuffer());
}
/**
* @throws BinaryDataException
*/
@@ -72,7 +67,8 @@ class PacketBatch{
public static function fromPackets(Packet ...$packets) : self{
$result = new self();
foreach($packets as $packet){
$result->putPacket($packet);
$packet->encode();
$result->serializer->putString($packet->getSerializer()->getBuffer());
}
return $result;
}