$wrappedResponses =
[];
$asyncMap =
new \
SplObjectStorage();
$client = null;
foreach ($responses as $r) { if (!
$r instanceof self
) { throw new \
TypeError(sprintf('"%s::stream()" expects parameter 1 to be an iterable of AsyncResponse objects, "%s" given.',
$class ??
static::
class,
get_debug_type($r)));
} if (null !==
$e =
$r->info
['error'
] ?? null
) { yield $r =>
$chunk =
new ErrorChunk($r->offset,
new TransportException($e));
$chunk->
didThrow() ?:
$chunk->
getContent();
continue;
} if (null ===
$client) { $client =
$r->client;
} elseif ($r->client !==
$client) { throw new TransportException('Cannot stream AsyncResponse objects with many clients.'
);
} $asyncMap[$r->response
] =
$r;
$wrappedResponses[] =
$r->response;