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 --- inc/mailgun/guzzlehttp/psr7/src/DroppingStream.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 inc/mailgun/guzzlehttp/psr7/src/DroppingStream.php (limited to 'inc/mailgun/guzzlehttp/psr7/src/DroppingStream.php') diff --git a/inc/mailgun/guzzlehttp/psr7/src/DroppingStream.php b/inc/mailgun/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000..8935c80 --- /dev/null +++ b/inc/mailgun/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} -- cgit v1.2.3