TextClient::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Nopolabs\Yabot\Plugins\Sms;
4
5
6
use Twilio\Rest\Client;
7
8
class TextClient
9
{
10
    private $client;
11
12
    public function __construct(array $config)
13
    {
14
        $username = $config['twilio']['sid'];
15
        $password = $config['twilio']['token'];
16
        $this->client = new Client($username, $password);
17
    }
18
19
    public function send($to, $from, $message)
20
    {
21
        $this->client->messages->create($to, ['from' => $from, 'body' => $message]);
22
    }
23
}