]> BookStack Code Mirror - bookstack/blob - app/Activity/Notifications/MessageParts/LinkedMailMessageLine.php
Updated readme attribution and fixed eslint issues
[bookstack] / app / Activity / Notifications / MessageParts / LinkedMailMessageLine.php
1 <?php
2
3 namespace BookStack\Activity\Notifications\MessageParts;
4
5 use Illuminate\Contracts\Support\Htmlable;
6
7 /**
8  * A line of text with linked text included, intended for use
9  * in MailMessages. The line should have a ':link' placeholder for
10  * where the link should be inserted within the line.
11  */
12 class LinkedMailMessageLine implements Htmlable
13 {
14     public function __construct(
15         protected string $url,
16         protected string $line,
17         protected string $linkText,
18     ) {
19     }
20
21     public function toHtml(): string
22     {
23         $link = '<a href="' . e($this->url) . '">' . e($this->linkText) . '</a>';
24         return str_replace(':link', $link, e($this->line));
25     }
26 }