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

VerificationCode::toSms()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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