NewThreadNotification::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Seongbae\Discuss\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Notifications\Messages\MailMessage;
8
use Illuminate\Notifications\Notification;
9
use Illuminate\Support\Facades\Log;
10
use App\Mail\TeamMemberAdded;
11
use Helper;
12
13
class NewThreadNotification extends Notification
14
{
15
    use Queueable;
16
17
    private $user;
18
    private $thread;
19
    private $msg;
20
21
    /**
22
     * Create a new notification instance.
23
     *
24
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
25
     */
26
    public function __construct($thread, $msg=null)
27
    {
28
        $this->thread = $thread;
29
        $this->msg = $msg;
30
    }
31
32
    /**
33
     * Get the notification's delivery channels.
34
     *
35
     * @param  mixed  $notifiable
36
     * @return array
37
     */
38
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        return ['mail'];
41
    }
42
43
    /**
44
     * Get the mail representation of the notification.
45
     *
46
     * @param  mixed  $notifiable
47
     * @return \Illuminate\Notifications\Messages\MailMessage
48
     */
49
    public function toMail($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        $url = route('discuss.show', ['channel'=>$this->thread->channel->slug, 'thread'=>$this->thread]);
52
53
        return (new MailMessage)
54
            ->subject($this->msg)
55
            ->markdown('discuss::emails.newthread',['thread'=>$this->thread, 'url'=>$url]);
56
57
    }
58
59
    /**
60
     * Get the array representation of the notification.
61
     *
62
     * @param  mixed  $notifiable
63
     * @return array
64
     */
65
    public function toArray($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
66
    {
67
        return [
68
69
        ];
70
    }
71
}
72