ResponseStream.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. /**
  20. * @var \Generator
  21. */
  22. private $generator;
  23. /**
  24. * @param \Generator $generator
  25. */
  26. public function __construct($generator)
  27. {
  28. $this->generator = $generator;
  29. }
  30. public function key()
  31. {
  32. return $this->generator->key();
  33. }
  34. public function current()
  35. {
  36. return $this->generator->current();
  37. }
  38. public function next()
  39. {
  40. $this->generator->next();
  41. }
  42. public function rewind()
  43. {
  44. $this->generator->rewind();
  45. }
  46. public function valid()
  47. {
  48. return $this->generator->valid();
  49. }
  50. }