FirstReminder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toMail() 0 3 1
A toArray() 0 5 1
A via() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace App\Notifications;
4
5
use App\Loan;
6
use App\Mail\FirstReminderEmail;
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Notifications\Notification;
9
10
class FirstReminder extends Notification
11
{
12
    use Queueable;
13
14
    protected $subjectTpl = [
15
        'eng' => '{thing} must be returned',
16
        'nob' => '{thing} må leveres tilbake',
17
        'nno' => '{thing} må leveres tilbake',  // @TODO
18
    ];
19
20
    public $loan_id;
21
    public $email;
22
23
    /**
24
     * Create a new notification instance.
25
     *
26
     * @param Loan $loan
27
     */
28
    public function __construct(Loan $loan)
29
    {
30
        $this->loan_id = $loan->id;
31
        $this->email = new FirstReminderEmail($loan);
32
    }
33
34
    /**
35
     * Get the notification's delivery channels.
36
     *
37
     * @param  mixed  $notifiable
38
     * @return array
39
     */
40
    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

40
    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...
41
    {
42
        return ['mail', ExtendedDatabaseChannel::class];
43
    }
44
45
    /**
46
     * Get the mail representation of the notification.
47
     *
48
     * @param  mixed $notifiable
49
     * @return FirstReminderEmail
50
     */
51
    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

51
    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...
52
    {
53
        return $this->email;
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
            'loan_id' => $this->loan_id,
66
            'email' => $this->email->toArray(),
67
        ];
68
    }
69
}
70