summaryrefslogtreecommitdiff
path: root/app/Model/Task.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-22 14:31:12 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-22 14:31:12 +0200
commitab1a4760ed5b35cf58fc6f3f4e3c31be4cff17f2 (patch)
tree757920b994d75df9490c2489e20513835913f465 /app/Model/Task.php
parenteeb4688dcc7caafeaa020a3cd9d78d18aea30353 (diff)
Basic prototype to handle Github webhooks
Diffstat (limited to 'app/Model/Task.php')
-rw-r--r--app/Model/Task.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Model/Task.php b/app/Model/Task.php
index 262e8d76..8708f128 100644
--- a/app/Model/Task.php
+++ b/app/Model/Task.php
@@ -696,4 +696,22 @@ class Task extends Base
return false;
}
+
+ /**
+ * Get a the task id from a text
+ *
+ * Example: "Fix bug #1234" will return 1234
+ *
+ * @access public
+ * @param string $message Text
+ * @return integer
+ */
+ public function getTaskIdFromText($message)
+ {
+ if (preg_match('!#(\d+)!i', $message, $matches) && isset($matches[1])) {
+ return $matches[1];
+ }
+
+ return 0;
+ }
}