/** * @param $title * @param string $message * @param string $color * @param string $link * @param string[] $fields * * @return MessageAttachment */ public function createAttachment($title, $message = '', $color = '', $link = '', $fields = []) { $attachment = new MessageAttachment(); $attachment->setColor($color); $attachment->setTitle($title); $attachment->setTitleLink($link); $attachment->setFallback($title); foreach ($fields as $key => $value) { $attachment->addField($key, $value, true); } $attachment->setText($message); return $attachment; }