Completed
Push — master ( af1fc3...36858c )
by Abdelrahman
06:22
created

PhoneVerificationNotification::via()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Fort Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Fort Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Fort\Notifications;
17
18
use Illuminate\Notifications\Notification;
19
use NotificationChannels\Authy\AuthyChannel;
20
use NotificationChannels\Authy\AuthyMessage;
21
22
class PhoneVerificationNotification extends Notification
23
{
24
    /**
25
     * The notification method (sms/call).
26
     *
27
     * @var string
28
     */
29
    public $method;
30
31
    /**
32
     * Determine whether to force the notification over cellphone network.
33
     *
34
     * @var bool
35
     */
36
    public $force;
37
38
    /**
39
     * Create a notification instance.
40
     *
41
     * @param string $method
42
     * @param bool   $force
43
     */
44
    public function __construct($method = 'sms', $force = false)
45
    {
46
        $this->method = $method;
47
        $this->force  = $force;
48
    }
49
50
    /**
51
     * Get the notification's channels.
52
     *
53
     * @param mixed $notifiable
54
     *
55
     * @return array|string
56
     */
57
    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...
58
    {
59
        return [AuthyChannel::class];
60
    }
61
62
    /**
63
     * Build the mail representation of the notification.
64
     *
65
     * @return \NotificationChannels\Authy\AuthyMessage
66
     */
67
    public function toAuthy()
68
    {
69
        $message = AuthyMessage::create()->method($this->method);
70
71
        if ($this->force) {
72
            $message->force();
73
        }
74
75
        return $message;
76
    }
77
}
78