NoSeekStream.php 470 B

12345678910111213141516171819202122232425
  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. public function seek($offset, $whence = SEEK_SET): void
  12. {
  13. throw new \RuntimeException('Cannot seek a NoSeekStream');
  14. }
  15. public function isSeekable(): bool
  16. {
  17. return false;
  18. }
  19. }