Plivo   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 42.11%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 2
dl 0
loc 28
ccs 8
cts 19
cp 0.4211
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B applyResponse() 0 20 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
            $this->numbers = collect($response['available_phone_numbers'])->pluck("phone_number")->all();
23 3
        }
24
25 3
        if (isset($response['status'])) {
26
            $this->status = $response["status"];
27
        }
28 3
    }
29
30
    public function successful()
31
    {
32
        return $this->status >= 200 && $this->status < 300;
33
    }
34
}
35