src/Protocol/CommitOffset.php
protected function encodePartition(array $values): string
    {
        if (! isset($values['partition'])) {
            throw new ProtocolException('given commit offset data invalid. `partition` is undefined.');
        }

        if (! isset($values['offset'])) {
            throw new ProtocolException('given commit offset data invalid. `offset` is undefined.');
        }

        if (! isset($values['metadata'])) {
            $values['metadata'] = '';
        }

        if (! isset($values['timestamp'])) {
            $values['timestamp'] = time() * 1000;
        }

        $version = $this->getApiVersion(self::OFFSET_COMMIT_REQUEST);

        $data  = self::pack(self::BIT_B32, (string) $values['partition']);
        $data .= self::pack(self::BIT_B64, (string) $values['offset']);

        if ($version === self::API_VERSION1) {
            $data .= self::pack(self::BIT_B64, (string) $values['timestamp']);
        }

        $data .= self::encodeString($values['metadata'], self::PACK_INT16);

        return $data;
    }
protected function encodePartition(array $values): string
    {
        if (! isset($values['partition'])) {
            throw new ProtocolException('given commit offset data invalid. `partition` is undefined.');
        }

        if (! isset($values['offset'])) {
            throw new ProtocolException('given commit offset data invalid. `offset` is undefined.');
        }

        if (! isset($values['metadata'])) {
            $values['metadata'] = '';
        }

        if (! isset($values['timestamp'])) {
            $values['timestamp'] = time() * 1000;
        }

        $version = $this->getApiVersion(self::OFFSET_COMMIT_REQUEST);

        $data  = self::pack(self::BIT_B32, (string) $values['partition']);
        $data .= self::pack(self::BIT_B64, (string) $values['offset']);

        if ($version === self::API_VERSION1) {
            $data .= self::pack(self::BIT_B64, (string) $values['timestamp']);
        }

        $data .= self::encodeString($values['metadata'], self::PACK_INT16);

        return $data;
    }
@param mixed[] $values

@throws NotSupported
@throws ProtocolException