From a44cc1d2e3c0f147e91a5c052ac7fd879e34e706 Mon Sep 17 00:00:00 2001 From: Eole Date: Thu, 21 Jan 2016 10:29:26 +0100 Subject: Init Server Composer Components --- .../vendor/guzzlehttp/psr7/src/DroppingStream.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 server/vendor/guzzlehttp/psr7/src/DroppingStream.php (limited to 'server/vendor/guzzlehttp/psr7/src/DroppingStream.php') diff --git a/server/vendor/guzzlehttp/psr7/src/DroppingStream.php b/server/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000..8935c80 --- /dev/null +++ b/server/vendor/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