Kafka\Protocol\Encoder::_encodeFetchTopic PHP Method

_encodeFetchTopic() protected static method

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

Usage Example

Beispiel #1
0
 /**
  * encodeFetchTopic
  *
  * @access public
  * @return void
  */
 public static function encodeFetchTopic($values)
 {
     return parent::_encodeFetchTopic($values);
 }