Skip to content

Commit

Permalink
Reduce keywordPos lines
Browse files Browse the repository at this point in the history
  • Loading branch information
iranianpep committed Jul 18, 2017
1 parent 34f4745 commit 87ab333
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Botonomous/utility/MessageUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ public function keywordPos(array $keywords, $message)
return $found;
}

$keywords = (new ArrayUtility())->sortArrayByLength($keywords);
foreach ($keywords as $keyword) {
foreach ((new ArrayUtility())->sortArrayByLength($keywords) as $keyword) {
$result = preg_match_all("/\b{$keyword}\b/", $message, $matches, PREG_OFFSET_CAPTURE);

if ($result && !empty($matches[0])) {
Expand Down

0 comments on commit 87ab333

Please sign in to comment.