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

Bandwidth::applyResponse()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4.5923

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 8
cts 12
cp 0.6667
rs 9.2
c 0
b 0
f 0
cc 4
eloc 8
nc 8
nop 1
crap 4.5923
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