Passed
Push — dev6 ( c88035...50a53d )
by Ron
17:16
created

EmailNewTechTipComment   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 13
c 1
b 0
f 0
dl 0
loc 53
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A via() 0 3 1
A toArray() 0 3 1
A toMail() 0 7 1
A __construct() 0 4 1
1
<?php
2
3
namespace App\Notifications;
4
5
use App\Events\NewTipCommentEvent;
6
use App\Models\TechTip;
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
use Illuminate\Notifications\Messages\MailMessage;
10
use Illuminate\Notifications\Notification;
11
12
class EmailNewTechTipComment extends Notification
13
{
14
    use Queueable;
15
16
    protected $commentData;
17
    protected $tipData;
18
19
    /**
20
     * Create a new notification instance.
21
     *
22
     * @return void
23
     */
24
    public function __construct(NewTipCommentEvent $commentData)
25
    {
26
        $this->commentData = $commentData;
27
        $this->tipData     = TechTip::find($commentData->tip_id);
28
    }
29
30
    /**
31
     * Get the notification's delivery channels.
32
     *
33
     * @param  mixed  $notifiable
34
     * @return array
35
     */
36
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    public function via(/** @scrutinizer ignore-unused */ $notifiable)

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

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

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

47
    public function toMail(/** @scrutinizer ignore-unused */ $notifiable)

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

Loading history...
48
    {
49
        return (new MailMessage)
50
                    ->subject('A Tech Tip has been commented on')
51
                    ->greeting($this->commentData->user.' has commented on Tech Tip - '.$this->tipData->subject)
52
                    ->line($this->commentData->comment)
53
                    ->action('Click to View the Tech Tip', url(route('tech-tips.show', $this->tipData->slug)));
54
    }
55
56
    /**
57
     * Get the array representation of the notification.
58
     *
59
     * @param  mixed  $notifiable
60
     * @return array
61
     */
62
    public function toArray($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

62
    public function toArray(/** @scrutinizer ignore-unused */ $notifiable)

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

Loading history...
63
    {
64
        return [
65
            //
66
        ];
67
    }
68
}
69