github: fix notices
[pharext/pharext.org] / app / Controller / Github / Index.php
index 2b16c7bfe84994bcd67dce0e273e589b7cd0e8a1..343c16f7e922b15be2942e3838ade6a726b29ec8 100644 (file)
@@ -3,16 +3,23 @@
 namespace app\Controller\Github;
 
 use app\Controller\Github;
+use app\Github\API\Repos\ReposCallback;
 
 class Index extends Github
 {
        function __invoke(array $args = null) {
-               if ($this->checkToken()) {
-                       list($repos, $links) = $this->github->listRepos(
-                               $this->app->getRequest()->getQuery("page"), 
-                               new \app\Github\API\Repos\ReposCallback($this->github)
-                       )->send();
-                       $this->app->display("github/index", compact("repos", "links"));
+               if (!$this->checkToken()) {
+                       return;
                }
+               $this->github->listRepos(
+                       $this->app->getRequest()->getQuery("page")
+               )->then(
+                       new ReposCallback($this->github)
+               )->done(function($results) {
+                       list(list($repos, $links)) = $results;
+                       $this->app->display("github/index", compact("repos", "links"));
+               });
+
+               $this->github->drain();
        }
 }