NoSeekStream.php 524 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. declare(strict_types=1);
  3. namespace GuzzleHttp\Psr7;
  4. use Psr\Http\Message\StreamInterface;
  5. /**
  6. * Stream decorator that prevents a stream from being seeked.
  7. */
  8. final class NoSeekStream implements StreamInterface
  9. {
  10. use StreamDecoratorTrait;
  11. /** @var StreamInterface */
  12. private $stream;
  13. public function seek($offset, $whence = SEEK_SET): void
  14. {
  15. throw new \RuntimeException('Cannot seek a NoSeekStream');
  16. }
  17. public function isSeekable(): bool
  18. {
  19. return false;
  20. }
  21. }