Passed
Push — master ( 73bdbf...2be37d )
by Adam
10:00
created

MigratedNotification::toMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.9332
1
<?php
2
3
namespace Coyote\Notifications\Post\Comment;
4
5
use Coyote\Notifications\Post\AbstractNotification;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Notifications\Messages\MailMessage;
8
9
class MigratedNotification extends AbstractNotification implements ShouldQueue
10
{
11
    const ID = \Coyote\Notification::POST_COMMENT_MIGRATED;
12
13
    /**
14
     * Get the mail representation of the notification.
15
     *
16
     * @return \Illuminate\Notifications\Messages\MailMessage
17
     */
18
    public function toMail()
19
    {
20
        return (new MailMessage)
21
            ->subject($this->getMailSubject())
22
            ->line(
23
                sprintf(
24
                    'Twój komentarz został zamieniony na post przez <strong>%s</strong>.',
25
                    $this->notifier->name
26
                )
27
            )
28
            ->line('<strong>Prosimy o prowadzenie dyskusji w postach!</strong>')
29
            ->line('Komentarze są jedynie dodatkiem na wypadek gdybyśmy musieli zwrócić uwagę na literówkę w poście, błędne formatowanie kodu itp.')
30
            ->action('Zobacz post', url($this->notificationUrl()))
31
            ->line('Jeżeli nie chcesz dostawać tego typu powiadomień, zmień ustawienia na swoim koncie użytkownika.');
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    protected function getMailSubject(): string
38
    {
39
        return $this->notifier->name . ' zamienił komentarz na post w wątku: ' . $this->post->topic->title;
40
    }
41
}
42