github: fix notices
[pharext/pharext.org] / app / Controller / Github / Repo.php
index 813b942bf0c2ec7f72345f29049b2ef9977070d5..3c166ad51c5c8812fbf90e87a6fccd7820707868 100644 (file)
@@ -8,19 +8,27 @@ use app\Github\API\Repos\RepoCallback;
 class Repo extends Github
 {
        function __invoke(array $args = null) {
+               if (!$this->checkToken()) {
+                       return;
+               }
+
                extract($args);
-               if ($this->checkToken()) {
-                       list($repo) = $this->github->readRepo("$owner/$name", new RepoCallback($this->github))->send();
+               $this->github->readRepo("$owner/$name")->then(
+                       new RepoCallback($this->github)
+               )->done(function($result) use($owner, $name) {
+                       list($repo) = $result;
                        $hook = $this->github->checkRepoHook($repo);
-                       
+
                        $this->app->getView()->addData(compact("owner", "name", "repo", "hook"));
-                       
-                       if (($modal = $this->app->getRequest()->getQuery("modal"))) {
-                               $action = $this->app->getRequest()->getQuery($modal);
-                               $this->app->getView()->addData(compact("modal", "action")); 
-                       }
-                       
-                       $this->app->display("github/repo");
+               });
+
+               $this->github->drain();
+
+               if (($modal = $this->app->getRequest()->getQuery("modal"))) {
+                       $action = $this->app->getRequest()->getQuery($modal);
+                       $this->app->getView()->addData(compact("modal", "action")); 
                }
+
+               $this->app->display("github/repo");
        }
 }