yet another github api refactoring
[pharext/pharext.org] / app / Controller / Github / Index.php
index c0838b7912af788da3fe83c9a276804b617d0818..2b16c7bfe84994bcd67dce0e273e589b7cd0e8a1 100644 (file)
@@ -8,21 +8,11 @@ class Index extends Github
 {
        function __invoke(array $args = null) {
                if ($this->checkToken()) {
-                       $this->github->listRepos(
+                       list($repos, $links) = $this->github->listRepos(
                                $this->app->getRequest()->getQuery("page"), 
-                               [$this, "reposCallback"]
+                               new \app\Github\API\Repos\ReposCallback($this->github)
                        )->send();
-                       $this->app->display("github/index");
-               }
-       }
-
-       function reposCallback($repos, $links) {
-               $this->app->getView()->addData(compact("repos", "links"));
-
-               foreach ($repos as $repo) {
-                       $this->github->listHooks($repo->full_name, function($hooks) use($repo) {
-                               $repo->hooks = $hooks;
-                       });
+                       $this->app->display("github/index", compact("repos", "links"));
                }
        }
 }