webhook create&delete
[pharext/pharext.org] / app / Controller / Github.php
index 0dfc5b00d0e09ea017a2e536a95219beead41216..6432c868670550c0355fdaad16e7a4e9087e6e2b 100644 (file)
@@ -49,15 +49,20 @@ abstract class Github implements Controller
                return false;
        }
 
+       /**
+        * Check if the pharext webhook is set for the repo and return its id
+        * @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 true;
+                                       return $hook->id;
                                }
                        }
                }
-               return false;
+               return null;
        }
 
        function createLinkGenerator($links) {