X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=examples%2Fhooks.php;h=37cb8e0ed2f895f9e58d3d4dbcf6b6f11ea4d0de;hb=HEAD;hp=dfcb6359d51d19bf154570cb8e761ab90cae90a8;hpb=e368287b3cd2dd40945ac8d1a1946bc32268007d;p=m6w6%2Fseekat diff --git a/examples/hooks.php b/examples/hooks.php index dfcb635..fdeca09 100755 --- a/examples/hooks.php +++ b/examples/hooks.php @@ -3,20 +3,15 @@ require_once __DIR__."/../vendor/autoload.php"; -use seekat\{API, API\Future, API\Links}; -use Monolog\{Logger, Handler}; +use seekat\API\Links; -$cli = new http\Client("curl", "seekat"); -$cli->configure([ +$client = new http\Client("curl", "seekat"); +$client->configure([ "max_host_connections" => 10, "max_total_connections" => 50, "use_eventloop" => true, ]); - -$log = new Logger("seekat"); -$log->pushHandler(new Handler\StreamHandler(STDERR, Logger::NOTICE)); - -$api = new API(Future\react(), API\auth("token", getenv("GITHUB_TOKEN")), null, $cli, $log); +$api = include "examples.inc"; $api(function() use($api) { $repos = yield $api->users->m6w6->repos([ @@ -30,7 +25,8 @@ $api(function() use($api) { foreach ($repos as $repo) { $batch[] = $repo->hooks(); } - foreach (yield $batch as $key => $hooks) { + $result = yield $batch; + foreach ($result as $key => $hooks) { if (!count($hooks)) { continue; }