From: David Reiss Date: Thu, 4 Oct 2007 23:02:01 +0000 (+0000) Subject: Thrift: TNullTransport for PHP. X-Git-Tag: 0.2.0~1180 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=6fc7be28bb1363adaedee47c34ea0262e3346eb4;p=common%2Fthrift.git Thrift: TNullTransport for PHP. Summary: We have this in C++. Adding an implementation for PHP. Reviewed By: mcslee Test Plan: Used it while testing web code. Revert Plan: ok git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665292 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/php/src/transport/TNullTransport.php b/lib/php/src/transport/TNullTransport.php new file mode 100644 index 00000000..b24cee5e --- /dev/null +++ b/lib/php/src/transport/TNullTransport.php @@ -0,0 +1,39 @@ + + */ + +/** + * Transport that only accepts writes and ignores them. + * This is useful for measuring the serialized size of structures. + * + * @package thrift.transport + * @author David Reiss + */ +class TNullTransport extends TTransport { + + public function isOpen() { + return true; + } + + public function open() {} + + public function close() {} + + public function read($len) { + throw new TTransportException("Can't read from TNullTransport."); + } + + public function write($buf) {} + +} + +?>