VerifyEmail   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 48
ccs 0
cts 18
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toMailUsing() 0 3 1
A via() 0 3 1
A toMail() 0 11 2
1
<?php
2
3
namespace MedianetDev\LaravelAuthApi\Http\Controllers\Traits\Notifications;
4
5
use Illuminate\Notifications\Messages\MailMessage;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Support\Facades\Lang;
8
9
class VerifyEmail extends Notification
10
{
11
    /**
12
     * The callback that should be used to build the mail message.
13
     *
14
     * @var \Closure|null
15
     */
16
    public static $toMailCallback;
17
18
    /**
19
     * Get the notification's channels.
20
     *
21
     * @param  mixed  $notifiable
22
     * @return array|string
23
     */
24
    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

24
    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...
25
    {
26
        return ['mail'];
27
    }
28
29
    /**
30
     * Build the mail representation of the notification.
31
     *
32
     * @param  mixed  $notifiable
33
     * @return \Illuminate\Notifications\Messages\MailMessage
34
     */
35
    public function toMail($notifiable)
36
    {
37
        if (static::$toMailCallback) {
38
            return call_user_func(static::$toMailCallback, $notifiable);
39
        }
40
41
        return (new MailMessage)
42
            ->subject(Lang::get('Verify Email Address ['.hexdec(substr(sha1($notifiable->getKey().$notifiable->getEmailForVerification()), 0, 3)).']'))
43
            ->line(Lang::get('MedianetDev\LaravelAuthApi\Notifications\VerifyEmail.php '))
44
            ->action(Lang::get(hexdec(substr(sha1($notifiable->getKey().$notifiable->getEmailForVerification()), 0, 3))), '')
45
            ->line(Lang::get('If you did not create an account, no further action is required.'));
46
    }
47
48
    /**
49
     * Set a callback that should be used when building the notification mail message.
50
     *
51
     * @param  \Closure  $callback
52
     * @return void
53
     */
54
    public static function toMailUsing($callback)
55
    {
56
        static::$toMailCallback = $callback;
57
    }
58
}
59