PHP 8.2.31
Preview: DroppingStream.php Size: 1.17 KB
//opt/cpanel/ea-wappspector/vendor/guzzlehttp/psr7/src/DroppingStream.php

<?php

declare(strict_types=1);

namespace GuzzleHttp\Psr7;

use Psr\Http\Message\StreamInterface;

/**
 * Stream decorator that begins dropping data once the size of the underlying
 * stream becomes too full.
 */
final class DroppingStream implements StreamInterface
{
    use StreamDecoratorTrait;

    /** @var int */
    private $maxLength;

    /** @var StreamInterface */
    private $stream;

    /**
     * @param StreamInterface $stream    Underlying stream to decorate.
     * @param int             $maxLength Maximum size before dropping data.
     */
    public function __construct(StreamInterface $stream, int $maxLength)
    {
        $this->stream = $stream;
        $this->maxLength = $maxLength;
    }

    public function write($string): int
    {
        $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));
    }
}

Directory Contents

Dirs: 1 × Files: 30

Name Size Perms Modified Actions
Exception DIR
- drwxr-xr-x 2026-03-10 16:41:02
Edit Download
5.81 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
3.14 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.49 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
1.17 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.21 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
3.85 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
3.00 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
1.38 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
1.06 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.18 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
8.14 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
7.61 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
55.82 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
6.85 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
524 B lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.49 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
3.95 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
3.81 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.79 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
661 B lrw-r--r-- 2026-03-10 16:41:02
Edit Download
9.33 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
7.21 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
3.24 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.53 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
4.98 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
21.50 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
1.12 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
8.26 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
8.38 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download
15.57 KB lrw-r--r-- 2026-03-10 16:41:02
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).