| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\HttpClient; |
| 13 |
|
| 14 |
use Symfony\Component\HttpClient\Response\AsyncResponse; |
| 15 |
use Symfony\Component\HttpClient\Response\ResponseStream; |
| 16 |
use Symfony\Contracts\HttpClient\ResponseInterface; |
| 17 |
use Symfony\Contracts\HttpClient\ResponseStreamInterface; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
trait AsyncDecoratorTrait |
| 25 |
{ |
| 26 |
use DecoratorTrait; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
abstract public function request(string $method, string $url, array $options = []): ResponseInterface; |
| 32 |
|
| 33 |
public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface |
| 34 |
{ |
| 35 |
if ($responses instanceof AsyncResponse) { |
| 36 |
$responses = [$responses]; |
| 37 |
} |
| 38 |
|
| 39 |
return new ResponseStream(AsyncResponse::stream($responses, $timeout, static::class)); |
| 40 |
} |
| 41 |
} |