protected function transform($data)
 {
     // UNSAFE
     foreach ($this->writeTrans_ as $trans) {
         switch ($trans) {
             case self::ZLIB_TRANSFORM:
                 $data = gzcompress($data);
                 break;
             case self::SNAPPY_TRANSFORM:
                 $data = sncompress($data);
                 break;
             default:
                 throw new TTransportException('Unknown transform during send', TTransportException::INVALID_TRANSFORM);
         }
     }
     return $data;
 }
 protected function transform($data)
 {
     // UNSAFE: the only way we know that these possibly iterated compressors
     // will produce reeasonable results is by complicated promises of the way
     // thrift sets things up, which Hack has no way to understand.
     foreach ($this->writeTrans_ as $trans) {
         switch ($trans) {
             case self::ZLIB_TRANSFORM:
                 $data = gzcompress($data);
                 break;
             case self::SNAPPY_TRANSFORM:
                 $data = sncompress($data);
                 break;
             default:
                 throw new TTransportException('Unknown transform during send', TTransportException::INVALID_TRANSFORM);
         }
     }
     return $data;
 }