From b76e2ff898b23745d4c9aaee49eeb7d88f2896ab Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 2 Mar 2017 22:49:24 -0500 Subject: Updated mailgun plugin --- .../message/src/Encoding/InflateStream.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 inc/mailgun/php-http/message/src/Encoding/InflateStream.php (limited to 'inc/mailgun/php-http/message/src/Encoding/InflateStream.php') diff --git a/inc/mailgun/php-http/message/src/Encoding/InflateStream.php b/inc/mailgun/php-http/message/src/Encoding/InflateStream.php new file mode 100644 index 0000000..7070230 --- /dev/null +++ b/inc/mailgun/php-http/message/src/Encoding/InflateStream.php @@ -0,0 +1,42 @@ + + */ +class InflateStream extends FilteredStream +{ + /** + * @param StreamInterface $stream + * @param int $level + */ + public function __construct(StreamInterface $stream, $level = -1) + { + if (!extension_loaded('zlib')) { + throw new \RuntimeException('The zlib extension must be enabled to use this stream'); + } + + parent::__construct($stream, ['window' => -15], ['window' => -15, 'level' => $level]); + } + + /** + * {@inheritdoc} + */ + protected function readFilter() + { + return 'zlib.inflate'; + } + + /** + * {@inheritdoc} + */ + protected function writeFilter() + { + return 'zlib.deflate'; + } +} -- cgit v1.2.3