Kafka\Protocol\Encoder::_encodeFetchOffset PHP Method

_encodeFetchOffset() protected static method

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

Usage Example

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