Passed
Push — master ( 004729...b97da3 )
by Tim
02:36
created

TextMessage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendMessage() 0 5 1
1
<?php
2
3
/**
4
 * Utilities for sending SMS
5
 *
6
 * @package tvdijen/simplesamlphp-module-cmdotcom
7
 */
8
9
declare(strict_types=1);
10
11
namespace SimpleSAML\Module\cmdotcom\Utils;
12
13
use CMText\TextClient;
14
use CMText\TextClientResult;
15
16
class TextMessage
17
{
18
    /**
19
     * Send OTP SMS
20
     *
21
     * @param string $code
22
     * @param string $recipient
23
     * @return \CMText\TextClientResult
24
     */
25
    public function sendMessage(string $api_key, string $code, string $recipient, string $originator): TextClientResult
26
    {
27
        $client = new TextClient($api_key);
28
        $result = $client->SendMessage($code, $originator, [$recipient]);
29
        return $result;
30
    }
31
}
32