private function isMatch(Message $message) : bool { if (!$message->isConversation()) { return false; } foreach ($this->patterns as $pattern => $response) { if (preg_match('/' . $pattern . '/iu', $this->normalizeText($message->getText())) === 1) { return true; } } return false; }
private function isMatch(Message $message) : bool { if (!$message->isConversation()) { return false; } foreach ($this->matches as $insult => $response) { if ($this->getMatchingPercentage($insult, $message->getText()) >= self::MINIMUM_MATCH_PERCENTAGE) { return true; } } return false; }