Completed
Push — master ( c0d451...eab989 )
by Tyler
02:24 queued 01:00
created

Bandwidth   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
wmc 5
lcom 2
cbo 3
dl 0
loc 21
ccs 8
cts 14
cp 0.5714
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A applyResponse() 0 13 4
A successful() 0 4 1
1
<?php
2
3
namespace LeadThread\Sms\Responses;
4
5
use LeadThread\Sms\Interfaces\SmsResponse;
6
use Catapult\PhoneNumbersCollection;
7
use Catapult\PhoneNumbers;
8
9
class Bandwidth extends Response
10
{
11 3
    public function applyResponse($response)
12
    {
13 3
        if (isset($response->messageId)) {
14
            $this->uuid = $response->messageId;
15
        }
16 3
        if ($response instanceof PhoneNumbersCollection) {
17 3
            $this->number = $response->first()->number;
18 3
            $this->numbers = collect($response->toArray())->pluck("number")->all();
19 3
        }
20 3
        if ($response instanceof PhoneNumbers) {
21
            $this->number = $response->number;
0 ignored issues
show
Bug introduced by
The property number does not seem to exist in Catapult\PhoneNumbers.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
22
        }
23 3
    }
24
25
    public function successful()
26
    {
27
        return $this->error === null;
28
    }
29
}
30