protected function isLastPacket($packet) { if (is_string($packet)) { return $packet === ''; } return !$packet; }