1
0
Fork 0

Allow fetching the http downloader and process executor from the loop

pull/9278/head
Jordi Boggiano 2020-10-13 10:28:36 +02:00
parent e537ae953e
commit 7917a7e757
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 22 additions and 4 deletions

View File

@ -21,22 +21,40 @@ use Symfony\Component\Console\Helper\ProgressBar;
*/
class Loop
{
/** @var HttpDownloader */
private $httpDownloader;
/** @var ProcessExecutor|null */
private $processExecutor;
/** @var Promise[]|null */
private $currentPromises;
public function __construct(HttpDownloader $httpDownloader = null, ProcessExecutor $processExecutor = null)
public function __construct(HttpDownloader $httpDownloader, ProcessExecutor $processExecutor = null)
{
$this->httpDownloader = $httpDownloader;
if ($this->httpDownloader) {
$this->httpDownloader->enableAsync();
}
$this->httpDownloader->enableAsync();
$this->processExecutor = $processExecutor;
if ($this->processExecutor) {
$this->processExecutor->enableAsync();
}
}
/**
* @return HttpDownloader
*/
public function getHttpDownloader()
{
return $this->httpDownloader;
}
/**
* @return ProcessExecutor|null
*/
public function getProcessExecutor()
{
return $this->processExecutor;
}
public function wait(array $promises, ProgressBar $progress = null)
{
/** @var \Exception|null */