public function pack(Request $request, $sync = null) { $content = $this->packer->packMap([IProto::CODE => $request->getType(), IProto::SYNC => (int) $sync]); if (null !== ($body = $request->getBody())) { $content .= $this->packer->packMap($body); } return PackUtils::packLength(strlen($content)) . $content; }
/** * {@inheritdoc} */ public function pack(Request $request, $sync = null) { // @see https://github.com/msgpack/msgpack-php/issues/45 $content = pack('C*', 0x82, IProto::CODE, $request->getType(), IProto::SYNC); $content .= msgpack_pack((int) $sync); if (null !== ($body = $request->getBody())) { $content .= msgpack_pack($body); } return PackUtils::packLength(strlen($content)) . $content; }