github: fix notices
[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 if (!$this->checkToken()) {
12 return;
13 }
14
15 extract($args);
16 $this->github->readRepo("$owner/$name")->then(
17 new RepoCallback($this->github)
18 )->done(function($result) use($owner, $name) {
19 list($repo) = $result;
20 $hook = $this->github->checkRepoHook($repo);
21
22 $this->app->getView()->addData(compact("owner", "name", "repo", "hook"));
23 });
24
25 $this->github->drain();
26
27 if (($modal = $this->app->getRequest()->getQuery("modal"))) {
28 $action = $this->app->getRequest()->getQuery($modal);
29 $this->app->getView()->addData(compact("modal", "action"));
30 }
31
32 $this->app->display("github/repo");
33 }
34 }