Пример #1
0
 private function getResponse(Message $message) : string
 {
     $text = $this->normalize($message->getText());
     foreach ($this->matches as $match) {
         if ($this->textDoesMatch($match['insult'], $text)) {
             return $match['response']['text'] . 'first';
         }
         if ($this->textDoesMatch($match['response'], $text)) {
             return $match['insult']['text'] . 'second';
         }
     }
 }