Kafka\Protocol\Encoder::_encodeOffsetTopic PHP Method

_encodeOffsetTopic() protected static method

encode signal topic
protected static _encodeOffsetTopic ( $values ) : string
return string
    protected static function _encodeOffsetTopic($values)
    {
        if (!isset($values['topic_name'])) {
            throw new \Kafka\Exception\Protocol('given offset data invalid. `topic_name` is undefined.');
        }
        if (!isset($values['partitions']) || empty($values['partitions'])) {
            throw new \Kafka\Exception\Protocol('given offset data invalid. `partitions` is undefined.');
        }
        $topic = self::encodeString($values['topic_name'], self::PACK_INT16);
        $partitions = self::encodeArray($values['partitions'], array(__CLASS__, '_encodeOffsetPartion'));
        return $topic . $partitions;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * encodeOffsetTopic
  *
  * @access public
  * @return void
  */
 public static function encodeOffsetTopic($values)
 {
     return parent::_encodeOffsetTopic($values);
 }