From 53d74b6cc03ababd3eec142fa99e92de0ca2be2c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 14 Apr 2011 21:09:20 +0000 Subject: [PATCH] Added streamData() method to interface Streamable --- inc/classes/interfaces/streams/class_Streamable.php | 7 +++++++ inc/classes/main/streams/class_ | 12 ++++++++++++ .../main/streams/crypto/class_McryptStream.php | 12 ++++++++++++ .../main/streams/crypto/class_NullCryptoStream.php | 12 ++++++++++++ 4 files changed, 43 insertions(+) diff --git a/inc/classes/interfaces/streams/class_Streamable.php b/inc/classes/interfaces/streams/class_Streamable.php index b5600168..c0e89f5d 100644 --- a/inc/classes/interfaces/streams/class_Streamable.php +++ b/inc/classes/interfaces/streams/class_Streamable.php @@ -22,6 +22,13 @@ * along with this program. If not, see . */ interface Streamable extends FrameworkInterface { + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + */ + function streamData ($data); } // [EOF] diff --git a/inc/classes/main/streams/class_ b/inc/classes/main/streams/class_ index d556b5ba..fe179d01 100644 --- a/inc/classes/main/streams/class_ +++ b/inc/classes/main/streams/class_ @@ -44,6 +44,18 @@ class ???Stream extends BaseStream implements Streamable { // Return the instance return $streamInstance; } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF] diff --git a/inc/classes/main/streams/crypto/class_McryptStream.php b/inc/classes/main/streams/crypto/class_McryptStream.php index a0fc4b53..829f35bc 100644 --- a/inc/classes/main/streams/crypto/class_McryptStream.php +++ b/inc/classes/main/streams/crypto/class_McryptStream.php @@ -150,6 +150,18 @@ class McryptStream extends BaseStream implements EncryptableStream { // Return the string return $str; } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called (which is a mistake) + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF] diff --git a/inc/classes/main/streams/crypto/class_NullCryptoStream.php b/inc/classes/main/streams/crypto/class_NullCryptoStream.php index bcaab6f0..a8fb9ecd 100644 --- a/inc/classes/main/streams/crypto/class_NullCryptoStream.php +++ b/inc/classes/main/streams/crypto/class_NullCryptoStream.php @@ -73,6 +73,18 @@ class NullCryptoStream extends BaseStream implements EncryptableStream { // Return it return $str; } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called (which is a mistake) + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF] -- 2.30.2