Ejemplo n.º 1
0
 public function analyze(MessageInterface $message)
 {
     if (mb_strpos($message->getBody(), 'spam') !== false) {
         $isSpam = true;
         $reason = 'spam word found';
     } else {
         $isSpam = false;
         $reason = null;
     }
     $result = new Result($isSpam, $reason);
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Convert message fields to request fields.
  *
  * @param  MessageInterface $message
  * @return string[]
  */
 protected function buildPostData(MessageInterface $message)
 {
     return array_filter(['ip' => $message->getIP(), 'agent' => $message->getUserAgent(), 'name' => $message->getName(), 'subject' => $message->getSubject(), 'link' => $message->getHomepage(), 'comment' => $message->getBody(), 'site' => $message->getOrigin()]);
 }