X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FController%2FGithub%2FIndex.php;h=2b16c7bfe84994bcd67dce0e273e589b7cd0e8a1;hb=36cfa28cf2dcee3422f0231f91c6692eb28e7824;hp=f55eb0c2e4cdece8ebbc739199bd5f83705a2937;hpb=ebc0d017c8a24bd16ca1f4347b39b07ba4349135;p=pharext%2Fpharext.org diff --git a/app/Controller/Github/Index.php b/app/Controller/Github/Index.php index f55eb0c..2b16c7b 100644 --- a/app/Controller/Github/Index.php +++ b/app/Controller/Github/Index.php @@ -4,32 +4,15 @@ namespace app\Controller\Github; use app\Controller\Github; -use http\QueryString; - class Index extends Github { function __invoke(array $args = null) { if ($this->checkToken()) { - try { - $this->github->fetchRepos( - $this->app->getRequest()->getQuery("page"), - [$this, "reposCallback"] - )->send(); - } catch (\app\Github\Exception $exception) { - $this->view->addData(compact("exception")); - } - $this->app->display("github/index"); - } - } - - function reposCallback($repos, $links) { - $this->app->getView()->addData(compact("repos")); - $this->app->getView()->registerFunction("link", $this->createLinkGenerator($links)); - - foreach ($repos as $repo) { - $this->github->fetchHooks($repo->full_name, function($hooks) use($repo) { - $repo->hooks = $hooks; - }); + 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")); } } }