Completed
Push — master ( e2547a...b91078 )
by Tyler
04:34
created

Plivo   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 38.89%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 27
ccs 7
cts 18
cp 0.3889
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B applyResponse() 0 19 6
A successful() 0 4 2
1
<?php
2
3
namespace LeadThread\Sms\Responses;
4
5
use LeadThread\Sms\Interfaces\SmsResponse;
6
7
class Plivo extends Response
8
{
9 3
    public function applyResponse($response)
10
    {
11 3
        if (isset($response['response'])) {
12
            if (isset($response['response']['error'])) {
13
                $this->error = $response['response']['error'];
14
            }
15
            if (isset($response['response']['message_uuid'])) {
16
                $this->uuid = $response['response']['message_uuid'][0];
17
            }
18
        }
19
20 3
        if (isset($response['available_phone_numbers'])) {
21 3
            $this->number = $response['available_phone_numbers'][0]['phone_number'];
22 3
        }
23
24 3
        if (isset($response['status'])) {
25
            $this->status = $response["status"];
26
        }
27 3
    }
28
29
    public function successful()
30
    {
31
        return $this->status >= 200 && $this->status < 300;
32
    }
33
}
34