Skip to content

Commit

Permalink
Cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyshockov committed Mar 22, 2017
1 parent c4d8341 commit 3c43063
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
36 changes: 18 additions & 18 deletions example/simple_query.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@

require __DIR__ . '/../vendor/autoload.php';

run(function ($loop) use ($genFn) {
// Logger to show pretty messages with timestamps.
$logger = new Logger('default');
$logger->pushHandler(new StreamHandler('php://stdout', Logger::INFO));
run(function ($loop) use ($genFn) {
// Logger to show pretty messages with timestamps.
$logger = new Logger('default');
$logger->pushHandler(new StreamHandler('php://stdout', Logger::INFO));

$httpHandler = new CurlMultiHandler($loop);
$stack = HandlerStack::create($httpHandler);
$httpHandler = new CurlMultiHandler($loop);
$stack = HandlerStack::create($httpHandler);

$httpClient = new Client([
'handler' => $stack,
]);
$httpClient = new Client([
'handler' => $stack,
]);

$promise = $httpClient->getAsync('https://google.com')->then(
function ($result) use ($logger) { $logger->info('Query completed!'); },
function ($reason) use ($logger) { $logger->error('Query failed :('); }
);
$promise = $httpClient->getAsync('https://google.com')->then(
function ($result) use ($logger) { $logger->info('Query completed!'); },
function ($reason) use ($logger) { $logger->error('Query failed :('); }
);

/*
* The promise isn't completed yet, but it will be resolved in the future, the event loop will take care of it.
* We don't need to call Promise::wait()!
*/
});
/*
* The promise isn't completed yet, but it will be resolved in the future, the event loop will take care of it.
* We don't need to call Promise::wait()!
*/
});
2 changes: 2 additions & 0 deletions example/throttle_coroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ function ($reason) use ($logger) { $logger->error('Query failed :('); }

// This will done only after the completion of all calls in each_limit().
echo 'Done!';

return 0;
});

0 comments on commit 3c43063

Please sign in to comment.