function HttpDownloader::getResponse
Parameters
int $index Job id:
2 calls to HttpDownloader::getResponse()
- HttpDownloader::copy in vendor/
composer/ composer/ src/ Composer/ Util/ HttpDownloader.php - Copy a file synchronously
- HttpDownloader::get in vendor/
composer/ composer/ src/ Composer/ Util/ HttpDownloader.php - Download a file synchronously
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ HttpDownloader.php, line 414
Class
- HttpDownloader
- @author Jordi Boggiano <j.boggiano@seld.be> @phpstan-type Request array{url: non-empty-string, options: mixed[], copyTo: string|null} @phpstan-type Job array{id: int, status: int, request: Request, sync: bool, origin: string, resolve?: callable,…
Namespace
Composer\UtilCode
private function getResponse(int $index) : Response {
if (!isset($this->jobs[$index])) {
throw new \LogicException('Invalid request id');
}
if ($this->jobs[$index]['status'] === self::STATUS_FAILED) {
assert(isset($this->jobs[$index]['exception']));
throw $this->jobs[$index]['exception'];
}
if (!isset($this->jobs[$index]['response'])) {
throw new \LogicException('Response not available yet, call wait() first');
}
$resp = $this->jobs[$index]['response'];
unset($this->jobs[$index]);
return $resp;
}