defer warnings/exceptions of the client
This enables the following pattern:
<?php
use http\Client;
function handle_response_and_dequeue($res) {
var_dump($res->getResponseCode());
return true; //dequeue
}
$client = new Client;
$client->enqueue(new Client\Request(...),"handle_response_and_dequeue");
$client->enqueue(new Client\Request(...),"handle_response_and_dequeue");
$client->enqueue(new Client\Request(...),"handle_response_and_dequeue");
while (count($client)) {
try {
$client->send();
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
}