MCPcopy Create free account
hub / github.com/apache/thrift / serialize

Method serialize

lib/php/lib/Serializer/TBinarySerializer.php:41–62  ·  view source on GitHub ↗

NOTE(rmarin): Because thrift_protocol_write_binary adds a begin message prefix, you cannot specify a transport in which to serialize an object. It has to be a string. Otherwise we will break the compatibility with normal deserialization.

($object)

Source from the content-addressed store, hash-verified

39 // be a string. Otherwise we will break the compatibility with
40 // normal deserialization.
41 public static function serialize($object)
42 {
43 $transport = new TMemoryBuffer();
44 $protocol = new TBinaryProtocolAccelerated($transport);
45 if (function_exists('thrift_protocol_write_binary')) {
46 thrift_protocol_write_binary(
47 $protocol,
48 $object->getName(),
49 TMessageType::REPLY,
50 $object,
51 0,
52 $protocol->isStrictWrite()
53 );
54
55 $protocol->readMessageBegin($unused_name, $unused_type, $unused_seqid);
56 } else {
57 $object->write($protocol);
58 }
59 $protocol->getTransport()->flush();
60
61 return $transport->getBuffer();
62 }
63
64 public static function deserialize($string_object, $class_name, $buffer_size = 8192)
65 {

Callers 1

testBinarySerializerMethod · 0.45

Calls 8

isStrictWriteMethod · 0.80
readMessageBeginMethod · 0.65
writeMethod · 0.65
getNameMethod · 0.45
flushMethod · 0.45
getTransportMethod · 0.45
getBufferMethod · 0.45

Tested by 1

testBinarySerializerMethod · 0.36