requestHeader('kafka-php', self::LIST_GROUPS_REQUEST, self::LIST_GROUPS_REQUEST); $data = self::encodeString($header, self::PACK_INT32); return $data; } // }}} // {{{ public function decode() /** * decode group response * * @access public * @return array */ public function decode($data) { $offset = 0; $errorCode = self::unpack(self::BIT_B16_SIGNED, substr($data, $offset, 2)); $offset += 2; $groups = $this->decodeArray(substr($data, $offset), array($this, 'listGroup')); return array( 'errorCode' => $errorCode, 'groups' => $groups['data'], ); } // }}} // {{{ protected function listGroup() /** * decode list group response * * @access protected * @return array */ protected function listGroup($data) { $offset = 0; $groupId = $this->decodeString(substr($data, $offset), self::BIT_B16); $offset += $groupId['length']; $protocolType = $this->decodeString(substr($data, $offset), self::BIT_B16); $offset += $protocolType['length']; return array( 'length' => $offset, 'data' => array( 'groupId' => $groupId['data'], 'protocolType' => $protocolType['data'], ) ); } // }}} // }}} }