64fbb9dbb67459bcac988e5d9f5eb31cfaa0809e
[pharext/pharext.org] / Repo.php
1 <?php
2
3 namespace app\Controller\Github;
4
5 use app\Controller\Github;
6 use app\Github\API\Repos\RepoCallback;
7
8 class Repo extends Github
9 {
10 function __invoke(array $args = null) {
11 extract($args);
12 if ($this->checkToken()) {
13 $this->github->readRepo("$owner/$name")->then(
14 new RepoCallback($this->github)
15 )->done(function($result) use($owner, $name) {
16 list($repo) = $result;
17 $hook = $this->github->checkRepoHook($repo);
18
19 $this->app->getView()->addData(compact("owner", "name", "repo", "hook"));
20 });
21 $this->github->drain();
22 }
23
24 if (($modal = $this->app->getRequest()->getQuery("modal"))) {
25 $action = $this->app->getRequest()->getQuery($modal);
26 $this->app->getView()->addData(compact("modal", "action"));
27 }
28
29 $this->app->display("github/repo");
30 }
31 }