2nd round
[pharext/pharext.org] / app / Controller / Github / 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
22 $this->github->drain();
23 }
24
25 if (($modal = $this->app->getRequest()->getQuery("modal"))) {
26 $action = $this->app->getRequest()->getQuery($modal);
27 $this->app->getView()->addData(compact("modal", "action"));
28 }
29
30 $this->app->display("github/repo");
31 }
32 }