defer warnings/exceptions of the client
authorMichael Wallner <mike@php.net>
Fri, 20 Mar 2015 07:28:40 +0000 (08:28 +0100)
committerMichael Wallner <mike@php.net>
Fri, 20 Mar 2015 07:36:09 +0000 (08:36 +0100)
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";
}
}


No differences found