yet another github api refactoring
[pharext/pharext.org] / app / Controller / Github.php
index 364f0e584424fa2a1438605f746f14ecf655c5b6..164f3205134070d8464ca6927382151f9f050594 100644 (file)
@@ -35,7 +35,7 @@ abstract class Github implements Controller
                        "location" => "github", 
                        "title" => "Github"
                ]);
-               $this->app->getView()->registerFunction("check", [$this, "checkRepoHook"]);
+               $this->app->getView()->registerFunction("check", [$github, "checkRepoHook"]);
                
                if (($header = $this->app->getRequest()->getHeader("Cache-Control", Header::class))) {
                        $params = $header->getParams();
@@ -57,20 +57,4 @@ abstract class Github implements Controller
                ]));
                return false;
        }
-
-       /**
-        * Check if the pharext webhook is set for the repo and return it
-        * @param object $repo
-        * @return int hook id
-        */
-       function checkRepoHook($repo) {
-               if ($repo->hooks) {
-                       foreach ($repo->hooks as $hook) {
-                               if ($hook->name === "web" && $hook->config->url === $this->github->getConfig()->hook->url) {
-                                       return $hook;
-                               }
-                       }
-               }
-               return null;
-       }
 }