Passed
Push — master ( 5d7fa4...5be085 )
by Zing
06:47
created

VerificationCode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A via() 0 3 1
A toSms() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zing\LaravelSms\Notifications;
6
7
use Illuminate\Notifications\Notification;
8
use Illuminate\Support\Carbon;
9
use Zing\LaravelSms\Channels\SmsChannel;
10
11
class VerificationCode extends Notification
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $code;
17
18
    /**
19
     * @var int
20
     */
21
    protected $ttl;
22
23
    /**
24
     * VerificationCode constructor.
25
     *
26
     * @param string $code
27
     * @param int $ttl
28
     */
29 3
    public function __construct($code, $ttl)
30
    {
31 3
        $this->code = $code;
32 3
        $this->ttl = $ttl;
33 3
    }
34
35 2
    public function via()
36
    {
37 2
        return [SmsChannel::class];
38
    }
39
40 3
    public function toSms()
41
    {
42 3
        return sprintf(config('sms.verification.content'), $this->code, $this->ttl);
43
    }
44
}
45