StreamableInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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\Exception\ClientExceptionInterface;
  12. use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
  13. use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
  14. use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
  15. /**
  16. * @author Nicolas Grekas <p@tchwork.com>
  17. */
  18. interface StreamableInterface
  19. {
  20. /**
  21. * Casts the response to a PHP stream resource.
  22. *
  23. * @return resource
  24. *
  25. * @throws TransportExceptionInterface When a network error occurs
  26. * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached
  27. * @throws ClientExceptionInterface On a 4xx when $throw is true
  28. * @throws ServerExceptionInterface On a 5xx when $throw is true
  29. */
  30. public function toStream(bool $throw = true);
  31. }