summaryrefslogtreecommitdiff
path: root/app/Model/Task.php
diff options
context:
space:
mode:
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;
+ }
}