ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
DroppingStream.php
Go to the documentation of this file.
1
<?
php
2
namespace
GuzzleHttp\Psr7
;
3
4
use
Psr\Http\Message\StreamInterface
;
5
10
class
DroppingStream
implements
StreamInterface
11
{
12
use
StreamDecoratorTrait
;
13
14
private
$maxLength
;
15
20
public
function
__construct
(
StreamInterface
$stream
,
$maxLength
)
21
{
22
$this->stream =
$stream
;
23
$this->maxLength =
$maxLength
;
24
}
25
26
public
function
write
($string)
27
{
28
$diff = $this->maxLength - $this->stream->getSize();
29
30
// Begin returning 0 when the underlying stream is too large.
31
if
($diff <= 0) {
32
return
0;
33
}
34
35
// Write the stream or a subset of the stream if needed.
36
if
(strlen($string) < $diff) {
37
return
$this->stream->write($string);
38
}
39
40
return
$this->stream->write(substr($string, 0, $diff));
41
}
42
}
GuzzleHttp\Psr7\$stream
$stream
PHP stream implementation.
Definition:
MessageTrait.php:21
GuzzleHttp\Psr7\DroppingStream\__construct
__construct(StreamInterface $stream, $maxLength)
Definition:
DroppingStream.php:20
GuzzleHttp\Psr7
Definition:
AppendStream.php:2
StreamInterface
StreamDecoratorTrait
GuzzleHttp\Psr7\DroppingStream\$maxLength
$maxLength
Definition:
DroppingStream.php:14
GuzzleHttp\Psr7\DroppingStream
Stream decorator that begins dropping data once the size of the underlying stream becomes too full...
Definition:
DroppingStream.php:10
php
GuzzleHttp\Psr7\DroppingStream\write
write($string)
Write data to the stream.
Definition:
DroppingStream.php:26
Psr\Http\Message\StreamInterface
Describes a data stream.
Definition:
StreamInterface.php:12
libs
composer
vendor
guzzlehttp
psr7
src
DroppingStream.php
Generated on Thu Feb 6 2025 19:01:16 for ILIAS by
1.8.13 (using
Doxyfile
)