ConfirmEmail::toMail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace BeyondCode\EmailConfirmation\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Notifications\Messages\MailMessage;
9
10
class ConfirmEmail extends Notification implements ShouldQueue
11
{
12
    use Queueable;
13
14
    /**
15
     * Get the notification's delivery channels.
16
     *
17
     * @param  mixed  $notifiable
18
     * @return array
19
     */
20
    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...
21
    {
22
        return ['mail'];
23
    }
24
25
    /**
26
     * Get the mail representation of the notification.
27
     *
28
     * @param  mixed  $notifiable
29
     * @return \Illuminate\Notifications\Messages\MailMessage
30
     */
31
    public function toMail($notifiable)
32
    {
33
        return (new MailMessage)
34
            ->subject(__('confirmation::confirmation.confirmation_subject'))
35
            ->line(__('confirmation::confirmation.confirmation_subject_title'))
36
            ->line(__('confirmation::confirmation.confirmation_body'))
37
            ->action(__('confirmation::confirmation.confirmation_button'),
38
                url("register/confirm/$notifiable->confirmation_code"));
0 ignored issues
show
Bug introduced by
It seems like url("register/confirm/{$...e->confirmation_code}") targeting url() can also be of type object<Illuminate\Contracts\Routing\UrlGenerator>; however, Illuminate\Notifications...SimpleMessage::action() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
39
    }
40
}