ResponseStream.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpClient\Response;
  11. use Symfony\Contracts\HttpClient\ChunkInterface;
  12. use Symfony\Contracts\HttpClient\ResponseInterface;
  13. use Symfony\Contracts\HttpClient\ResponseStreamInterface;
  14. /**
  15. * @author Nicolas Grekas <p@tchwork.com>
  16. */
  17. final class ResponseStream implements ResponseStreamInterface
  18. {
  19. private $generator;
  20. public function __construct(\Generator $generator)
  21. {
  22. $this->generator = $generator;
  23. }
  24. public function key(): ResponseInterface
  25. {
  26. return $this->generator->key();
  27. }
  28. public function current(): ChunkInterface
  29. {
  30. return $this->generator->current();
  31. }
  32. public function next(): void
  33. {
  34. $this->generator->next();
  35. }
  36. public function rewind(): void
  37. {
  38. $this->generator->rewind();
  39. }
  40. public function valid(): bool
  41. {
  42. return $this->generator->valid();
  43. }
  44. }