/** * @param string $message * @return object */ protected function translate($message) { $class = new ReflectionClass($this->_className); $object = $class->newInstanceArgs(); $this->_transport->write($message); $object->read($this->_protocol); return $object; }
public static function deserialize($str, $object, $disable_hphp_extension = false) { $transport = new TMemoryBuffer(); $protocol = new TBinaryProtocolAccelerated($transport); if (\hacklib_cast_as_boolean(function_exists('thrift_protocol_read_binary')) && !\hacklib_cast_as_boolean($disable_hphp_extension)) { $protocol->writeMessageBegin('', TMessageType::REPLY, 0); $transport->write($str); $object = thrift_protocol_read_binary($protocol, get_class($object), $protocol->isStrictRead()); } else { $transport->write($str); $object->read($protocol); } return $object; }
public static function deserialize($string_object, $class_name) { $transport = new TMemoryBuffer(); $protocol = new TBinaryProtocolAccelerated($transport); if (function_exists('thrift_protocol_read_binary')) { $protocol->writeMessageBegin('', TMessageType::REPLY, 0); $transport->write($string_object); return thrift_protocol_read_binary($protocol, $class_name, $protocol->isStrictRead()); } else { $transport->write($string_object); $object = new $class_name(); $object->read($protocol); return $object; } }
public static function deserialize($str, $object, $override_version = null, $disable_hphp_extension = false) { $transport = new TMemoryBuffer(); $protocol = new TCompactProtocolAccelerated($transport); $use_hphp_extension = \hacklib_cast_as_boolean(function_exists('thrift_protocol_read_compact')) && !\hacklib_cast_as_boolean($disable_hphp_extension); if ($override_version !== null) { $protocol->setWriteVersion($override_version); if (!\hacklib_cast_as_boolean(function_exists('thrift_protocol_set_compact_version'))) { $use_hphp_extension = false; } } if (\hacklib_cast_as_boolean($use_hphp_extension)) { $protocol->writeMessageBegin('', TMessageType::REPLY, 0); $transport->write($str); $object = thrift_protocol_read_compact($protocol, get_class($object)); } else { $transport->write($str); $object->read($protocol); } return $object; }