Test Failed
Push — master ( dffb7e...651417 )
by Burak
10:17
created

ThreadCreated   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 41.67%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 54
ccs 5
cts 12
cp 0.4167
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toMail() 0 6 1
A via() 0 3 1
A toArray() 0 3 1
1
<?php
2
3
namespace App\Notifications;
4
5
use App\Http\Resources\ThreadResource;
6
use App\Models\Thread;
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 ThreadCreated extends Notification implements ShouldQueue
13
{
14
    use Queueable;
15
16
    /**
17
     * @var Thread
18
     */
19
    public Thread $thread;
20
21
    /**
22
     * Create a new notification instance.
23
     *
24
     * @param Thread $thread
25
     * @return void
26
     */
27 9
    public function __construct(Thread $thread)
28
    {
29 9
        $this->thread = $thread;
30 9
    }
31
32
    /**
33
     * Get the notification's delivery channels.
34
     *
35
     * @param  mixed  $notifiable
36
     * @return array
37
     */
38 9
    public function via($notifiable)
39
    {
40 9
        return $notifiable->notify_via;
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. ( Ignorable by Annotation )

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

49
    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...
50
    {
51
        return (new MailMessage)
52
                    ->line('The introduction to the notification.')
53
                    ->action('Notification Action', url('/'))
54
                    ->line('Thank you for using our application!');
55
    }
56
57
    /**
58
     * Get the array representation of the notification.
59
     *
60
     * @param  mixed  $notifiable
61
     * @return array
62
     */
63
    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

63
    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...
64
    {
65
        return (new ThreadResource($this->thread))->resolve();
66
    }
67
}
68