Skip to content

Commit 6d3ebf2

Browse files
committed
simplifying trigger words array
1 parent 4c2357a commit 6d3ebf2

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/AppBundle/GitHub/StatusManager.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class StatusManager
1010
const STATUS_REVIEWED = 'reviewed';
1111

1212
private static $triggerWords = [
13-
self::STATUS_NEEDS_REVIEW => ['needs review'],
14-
self::STATUS_NEEDS_WORK => ['needs work'],
15-
self::STATUS_WORKS_FOR_ME => ['works for me'],
16-
self::STATUS_REVIEWED => ['reviewed'],
13+
self::STATUS_NEEDS_REVIEW => 'needs review',
14+
self::STATUS_NEEDS_WORK => 'needs work',
15+
self::STATUS_WORKS_FOR_ME => 'works for me',
16+
self::STATUS_REVIEWED => 'reviewed',
1717
];
1818

1919
private static $labels = [
@@ -47,14 +47,12 @@ public function getStatusChangeFromComment($comment)
4747
$statusString = trim(substr($comment, $statusPosition));
4848

4949
$newStatus = null;
50-
foreach (self::$triggerWords as $status => $triggerWords) {
51-
foreach ($triggerWords as $triggerWord) {
52-
// status should be right at the beginning of the string
53-
if (stripos($statusString, $triggerWord) === 0) {
54-
// don't return immediately - we use the last status
55-
// in the rare case there are multiple
56-
$newStatus = $status;
57-
}
50+
foreach (self::$triggerWords as $status => $triggerWord) {
51+
// status should be right at the beginning of the string
52+
if (stripos($statusString, $triggerWord) === 0) {
53+
// don't return immediately - we use the last status
54+
// in the rare case there are multiple
55+
$newStatus = $status;
5856
}
5957
}
6058

0 commit comments

Comments
 (0)