VerifyMobile::via()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Fouladgar\MobileVerification\Notifications;
4
5
use Fouladgar\MobileVerification\Contracts\MustVerifyMobile;
6
use Fouladgar\MobileVerification\Notifications\Channels\VerificationChannel;
7
use Fouladgar\MobileVerification\Notifications\Messages\MobileVerificationMessage;
8
use Illuminate\Notifications\Notification;
9
10
class VerifyMobile extends Notification
11
{
12
    /**
13
     * The verification token.
14
     *
15
     * @var string
16
     */
17
    public $token;
18
19
    /**
20
     * Create a notification instance.
21
     *
22
     * @param string $token
23
     *
24
     * @return void
25
     */
26
    public function __construct(string $token)
27
    {
28
        $this->token = $token;
29
    }
30
31
    /**
32
     * Get the notification's channels.
33
     *
34
     * @param mixed $notifiable
35
     *
36
     * @return array|string
37
     */
38
    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

38
    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...
39
    {
40
        return [VerificationChannel::class];
41
    }
42
43
    /**
44
     * Build the mobile representation of the notification.
45
     *
46
     * @param $notifiable
47
     *
48
     * @return MobileVerificationMessage
49
     */
50
    public function toMobile(MustVerifyMobile $notifiable): MobileVerificationMessage
51
    {
52
        return (new MobileVerificationMessage())->to($notifiable->getMobileForVerification())
53
            ->token($this->token);
54
    }
55
}
56