X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fpromise.php;h=b39890d8d51158bc21af4f350dd57724dd9c0973;hb=654d736df2c46ec2520f73e9089d06a44f2b9c50;hp=c26e91131fee05377d99e8cf6ab74b8b159d3901;hpb=f4aa6beaf2e1f0dc9c877782cbbad5a989194517;p=m6w6%2Fseekat diff --git a/examples/promise.php b/examples/promise.php index c26e911..b39890d 100755 --- a/examples/promise.php +++ b/examples/promise.php @@ -1,25 +1,19 @@ #!/usr/bin/env php pushHandler((new Monolog\Handler\StreamHandler(STDERR))->setLevel(Monolog\Logger::NOTICE)); - -$api = new API(Future\amp(), API\auth("token", getenv("GITHUB_TOKEN")), null, null, $log); - -$api->users->m6w6->gists()->when(function($error, $gists) { +$api->users->m6w6->gists()->onResolve(function($error, $gists) { + $error and die($error); foreach ($gists as $gist) { - $gist->commits()->when(function($error, $commits) use($gist) { + $gist->commits()->onResolve(function($error, $commits) use($gist) { + $error and die($error); foreach ($commits as $i => $commit) { if (!$i) { printf("\nGist %s, %s:\n", $gist->id, $gist->description ?: ""); } $cs = $commit->change_status; - printf("\t%s: ", substr($commit->version,0,8)); + printf("\t%s: ", substr($commit->version, 0, 8)); printf("-%s+%s=%s\n", $cs->deletions, $cs->additions, $cs->total); } });