protected function executeBatches(InputInterface $input, OutputInterface $output)
{
$totalResult = array();
if (!$this->_options['silent']) {
$output->writeln('<info>Found ' . count($this->_batches) . ' sets to process.</info>');
}
$setCount = count($this->_batches);
$bi = 1;
// batch number
foreach ($this->_batches as $set) {
// sitemaps
$meta = $set['metadata'];
$batchesCount = count($set['requests']);
$setResults = array();
if (!$this->_options['silent']) {
$progress = new ProgressBar($output, $batchesCount);
$progress->setFormat('<info> %message% </info>' . PHP_EOL . '%current%/%max% [%bar%] <comment> %percent:3s%% - %elapsed:6s%/%estimated:-6s% </comment>');
$progress->setMessage('Now executing batch: ' . $bi . '/' . $setCount);
$progress->start();
}
foreach ($set['requests'] as $batch) {
// the batches of requests, singular or plural
$batchResult = array();
foreach ($batch as $request) {
$response = $this->simpleCurl($request);
$response['comparison_key'] = strtr($response['url'], array(rtrim($this->_options['compare-url'], "/") => '', rtrim($this->_options['current-url'], "/") => ''));
array_push($batchResult, $response);
}
array_push($setResults, $batchResult);
if (!$this->_options['silent']) {
$progress->clear();
$progress->setMessage($this->parseStatusMessage($batchResult));
$progress->display();
$progress->advance();
}
}
if (!$this->_options['silent']) {
$progress->setMessage('Task is finished');
$progress->finish();
}
array_push($totalResult, $setResults);
$bi++;
}
return $totalResult;
}