Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 /**
  * {@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;
 }