PsrStream.php 706 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Aws\Handler\GuzzleV5;
  3. use GuzzleHttp\Stream\StreamDecoratorTrait;
  4. use GuzzleHttp\Stream\StreamInterface as GuzzleStreamInterface;
  5. use Psr\Http\Message\StreamInterface as Psr7StreamInterface;
  6. /**
  7. * Adapts a Guzzle 5 Stream to a PSR-7 Stream.
  8. *
  9. * @codeCoverageIgnore
  10. */
  11. class PsrStream implements Psr7StreamInterface
  12. {
  13. use StreamDecoratorTrait;
  14. /** @var GuzzleStreamInterface */
  15. private $stream;
  16. public function __construct(GuzzleStreamInterface $stream)
  17. {
  18. $this->stream = $stream;
  19. }
  20. public function rewind()
  21. {
  22. $this->stream->seek(0);
  23. }
  24. public function getContents()
  25. {
  26. return $this->stream->getContents();
  27. }
  28. }