Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
iranianpep committed Jul 17, 2017
1 parent 61ba31d commit c607562
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Botonomous/utility/MessageUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public function keywordPos(array $keywords, $message)
return $found;
}

usort($keywords, [$this, 'compareLength']);
usort($keywords, function ($array1, $array2) {
return strlen($array2) <=> strlen($array1);
});

foreach ($keywords as $keyword) {
$result = preg_match_all("/\b{$keyword}\b/", $message, $matches, PREG_OFFSET_CAPTURE);
Expand All @@ -151,11 +153,6 @@ public function keywordPos(array $keywords, $message)
return $found;
}

private function compareLength($array1, $array2)
{
return strlen($array2) <=> strlen($array1);
}

private function isPositionTaken(array $tokensPositions, $newPosition)
{
if (empty($tokensPositions)) {
Expand Down

0 comments on commit c607562

Please sign in to comment.