Exception
1 year ago
AppendStream.php
2 months ago
BufferStream.php
2 months ago
CachingStream.php
2 months ago
DroppingStream.php
2 months ago
FnStream.php
2 months ago
Header.php
2 months ago
HttpFactory.php
1 year ago
InflateStream.php
1 year ago
LazyOpenStream.php
1 year ago
LimitStream.php
2 months ago
Message.php
2 months ago
MessageTrait.php
2 months ago
MimeType.php
2 months ago
MultipartStream.php
2 months ago
NoSeekStream.php
2 months ago
PumpStream.php
2 months ago
Query.php
1 year ago
Request.php
2 months ago
Response.php
2 months ago
Rfc3986.php
2 months ago
Rfc7230.php
2 months ago
ServerRequest.php
2 months ago
Stream.php
2 months ago
StreamDecoratorTrait.php
2 months ago
StreamWrapper.php
2 months ago
UploadedFile.php
2 months ago
Uri.php
2 months ago
UriComparator.php
2 months ago
UriNormalizer.php
2 months ago
UriResolver.php
2 months ago
Utils.php
2 months ago
NoSeekStream.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace GuzzleHttp\Psr7; |
| 6 | |
| 7 | use Psr\Http\Message\StreamInterface; |
| 8 | |
| 9 | /** |
| 10 | * Stream decorator that prevents a stream from being seeked. |
| 11 | */ |
| 12 | final class NoSeekStream implements StreamInterface |
| 13 | { |
| 14 | use StreamDecoratorTrait; |
| 15 | |
| 16 | /** @var StreamInterface */ |
| 17 | private $stream; |
| 18 | |
| 19 | public function seek($offset, $whence = SEEK_SET): void |
| 20 | { |
| 21 | if (!\is_int($offset)) { |
| 22 | \trigger_deprecation( |
| 23 | 'guzzlehttp/psr7', |
| 24 | '2.11', |
| 25 | 'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $offset.', |
| 26 | \get_debug_type($offset) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | if (!\is_int($whence)) { |
| 31 | \trigger_deprecation( |
| 32 | 'guzzlehttp/psr7', |
| 33 | '2.11', |
| 34 | 'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $whence.', |
| 35 | \get_debug_type($whence) |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | throw new \RuntimeException('Cannot seek a NoSeekStream'); |
| 40 | } |
| 41 | |
| 42 | public function isSeekable(): bool |
| 43 | { |
| 44 | return false; |
| 45 | } |
| 46 | } |
| 47 |