TransactionalSms::sendTransactional()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0046

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 7
ccs 5
cts 6
cp 0.8333
crap 1.0046
rs 9.4285
c 0
b 0
f 0
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