From 6fc7be28bb1363adaedee47c34ea0262e3346eb4 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Thu, 4 Oct 2007 23:02:01 +0000 Subject: [PATCH] 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 --- lib/php/src/transport/TNullTransport.php | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/php/src/transport/TNullTransport.php 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) {} + +} + +?> -- 2.17.1