SipgateClient   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A send() 0 6 2
1
<?php
2
3
namespace NotificationChannels\Sipgate;
4
5
use GuzzleHttp\ClientInterface as HttpClient;
6
use GuzzleHttp\Exception\GuzzleException;
7
use NotificationChannels\Sipgate\Exceptions\CouldNotSendNotification;
8
9
class SipgateClient
10
{
11
    /**
12
     * @var HttpClient
13
     */
14
    protected $http;
15
16
    /**
17
     * SipgateClient constructor.
18
     * @param  HttpClient  $http
19
     */
20 2
    public function __construct(HttpClient $http)
21
    {
22 2
        $this->http = $http;
23 2
    }
24
25
    /**
26
     * @param  SipgateMessage  $message
27
     * @throws CouldNotSendNotification
28
     */
29 2
    public function send(SipgateMessage $message)
30
    {
31
        try {
32 2
            $this->http->post('sessions/sms', ['json' => $message]);
33 1
        } catch (GuzzleException $exception) {
34 1
            throw CouldNotSendNotification::connectionFailed($exception);
35
        }
36 1
    }
37
}
38