Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../vendor/guzzleht.../psr7/src
File: DroppingStream.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace GuzzleHttp\Psr7;
[2] Fix | Delete
[3] Fix | Delete
use Psr\Http\Message\StreamInterface;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Stream decorator that begins dropping data once the size of the underlying
[7] Fix | Delete
* stream becomes too full.
[8] Fix | Delete
*
[9] Fix | Delete
* @final
[10] Fix | Delete
*/
[11] Fix | Delete
class DroppingStream implements StreamInterface
[12] Fix | Delete
{
[13] Fix | Delete
use StreamDecoratorTrait;
[14] Fix | Delete
[15] Fix | Delete
private $maxLength;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* @param StreamInterface $stream Underlying stream to decorate.
[19] Fix | Delete
* @param int $maxLength Maximum size before dropping data.
[20] Fix | Delete
*/
[21] Fix | Delete
public function __construct(StreamInterface $stream, $maxLength)
[22] Fix | Delete
{
[23] Fix | Delete
$this->stream = $stream;
[24] Fix | Delete
$this->maxLength = $maxLength;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
public function write($string)
[28] Fix | Delete
{
[29] Fix | Delete
$diff = $this->maxLength - $this->stream->getSize();
[30] Fix | Delete
[31] Fix | Delete
// Begin returning 0 when the underlying stream is too large.
[32] Fix | Delete
if ($diff <= 0) {
[33] Fix | Delete
return 0;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
// Write the stream or a subset of the stream if needed.
[37] Fix | Delete
if (strlen($string) < $diff) {
[38] Fix | Delete
return $this->stream->write($string);
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
return $this->stream->write(substr($string, 0, $diff));
[42] Fix | Delete
}
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function