TransactionalSms   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A sendTransactional() 0 7 1
1
<?php
2
namespace Sender;
3
4
use Sender\Sms\SmsNormal;
5
6
/**
7
 * This Class provide Transactional SMS APIs
8
 *
9
 * @package    Msg91 SMS&OTP package
10
 * @author     VenkatS <[email protected]>
11
 * @link       https://github.com/tesark/msg91-php
12
 * @license    MIT
13
 */
14
15
class TransactionalSms
16
{
17
    /**
18
     * Auth key
19
     * @var string $transAuthKey Transaction Auth key
20
     */
21
    protected $transAuthKey;
22 40
    public function __construct($authkey = null)
23
    {
24 40
        $this->transAuthKey = $authkey;
25 40
    }
26
    /**
27
     *  Send transactional SMS MSG91 Service
28
     * @param  int|string $mobileNumber
29
     * @param  array $data
30
     *
31
     * @return string
32
     */
33 40
    public function sendTransactional($mobileNumber, $data)
34
    {
35 40
        $sms = new SmsNormal();
36 40
        $transAuthKey = $this->transAuthKey;
37 40
        $data['mobile'] = $mobileNumber;
38 40
        $response = $sms->smsCategory($data, 1, $transAuthKey);
39
        return $response;
40
    }
41
}
42