public function ban(array
$urls): void
{ $list =
[];
foreach ($urls as $url) { $list[] =
new Request('POST', self::API_URL . '/purge/' .
$this->appUrl .
$url,
[ 'Fastly-Key' =>
$this->apiKey,
'fastly-soft-purge' =>
$this->softPurge,
]);
} $pool =
new Pool($this->client,
$list,
[ 'concurrency' =>
$this->concurrency,
'rejected' =>
function DTransferException
$reason): void
{ if ($reason instanceof ServerException
) { throw new \
RuntimeException(\
sprintf('BAN request failed to %s failed with error: %s',
$reason->
getRequest()->
getUri()->
__toString(),
$reason->
getMessage()), 0,
$reason);
} throw $reason;
},
]);
$pool->
promise()->
wait();
}